diff --git a/docs/tutorial/groups.md b/docs/tutorial/groups.md index 1b3677a5..fbb58aab 100644 --- a/docs/tutorial/groups.md +++ b/docs/tutorial/groups.md @@ -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 diff --git a/galaxy/management/commands/generate_galaxy_test_data.py b/galaxy/management/commands/generate_galaxy_test_data.py index 2c3ab7c8..d0dea4a5 100644 --- a/galaxy/management/commands/generate_galaxy_test_data.py +++ b/galaxy/management/commands/generate_galaxy_test_data.py @@ -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) ] )