From 73146375207815fd7177e6d145ea203cee08e941 Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 14 Apr 2024 16:15:14 +0200 Subject: [PATCH] fix: use existing adoption notices so no new oes are created --- src/fellchensammlung/management/commands/populate_db.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fellchensammlung/management/commands/populate_db.py b/src/fellchensammlung/management/commands/populate_db.py index 6c35ef5..37c233f 100644 --- a/src/fellchensammlung/management/commands/populate_db.py +++ b/src/fellchensammlung/management/commands/populate_db.py @@ -1,10 +1,11 @@ from django.core.management.base import BaseCommand, CommandError from django.core.files import File -from fellchensammlung.models import * from fellchensammlung import baker_recipes from model_bakery import baker +from fellchensammlung.models import AdoptionNotice, Species, Animal, Image, ModerationAction, User, Member, Rule, Report + class Command(BaseCommand): help = "Populates the database with test data" @@ -39,7 +40,6 @@ class Command(BaseCommand): animal.photos.add(image_object) - rule1 = baker.make(Rule, title="Be excellent ot each other", rule_text="This is **markdown**") rule2 = baker.make(Rule, title="Keep al least the minimum number of animals for species", @@ -48,12 +48,15 @@ class Command(BaseCommand): title="Rule three", rule_text="Everything needs at least three rules") - report1 = baker.make(Report, reported_broken_rules=[rule1, rule2], comment="This seems sketchy") + report1 = baker.make(Report, adoption_notice=adoption1, reported_broken_rules=[rule1, rule2], + comment="This seems sketchy") moderation_action1 = baker.make(ModerationAction, + report=report1, action=ModerationAction.COMMENT, public_comment="This has been seen by a moderator") moderation_action1 = baker.make(ModerationAction, + report=report1, action=ModerationAction.DELETE, public_comment="A moderator has deleted the reported content")