mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 07:41:14 +00:00
fix galaxy tests
This commit is contained in:
parent
a051e3cecc
commit
b3f8b2cce0
@ -128,6 +128,14 @@ Par exemple :
|
||||
INNER JOIN "auth_group" ON ("core_group"."group_ptr_id" = "auth_group"."id")
|
||||
```
|
||||
|
||||
!!!warning
|
||||
|
||||
Django réussit à abstraire assez bien la logique relationnelle.
|
||||
Cependant, gardez bien en mémoire que ce n'est pas quelque chose
|
||||
de magique et que cette manière de faire a des limitations.
|
||||
Par exemple, il devient impossible de `bulk_create`
|
||||
des groupes.
|
||||
|
||||
|
||||
## La définition d'un groupe
|
||||
|
||||
|
@ -121,12 +121,20 @@ class Command(BaseCommand):
|
||||
"""Create all the clubs [club.models.Club][].
|
||||
|
||||
After creation, the clubs are stored in `self.clubs` for fast access later.
|
||||
Don't create the groups associated to the clubs
|
||||
nor the pages of the clubs ([core.models.Page][]).
|
||||
Don't create the pages of the clubs ([core.models.Page][]).
|
||||
"""
|
||||
# dummy groups.
|
||||
# the galaxy doesn't care about the club groups,
|
||||
# but it's necessary to add them nonetheless in order
|
||||
# not to break the integrity constraints
|
||||
self.clubs = Club.objects.bulk_create(
|
||||
[
|
||||
Club(unix_name=f"galaxy-club-{i}", name=f"club-{i}")
|
||||
Club(
|
||||
unix_name=f"galaxy-club-{i}",
|
||||
name=f"club-{i}",
|
||||
board_group=Group.objects.create(name=f"board {i}"),
|
||||
members_group=Group.objects.create(name=f"members {i}"),
|
||||
)
|
||||
for i in range(self.NB_CLUBS)
|
||||
]
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user