fix: use existing adoption notices so no new oes are created
This commit is contained in:
		@@ -1,10 +1,11 @@
 | 
				
			|||||||
from django.core.management.base import BaseCommand, CommandError
 | 
					from django.core.management.base import BaseCommand, CommandError
 | 
				
			||||||
from django.core.files import File
 | 
					from django.core.files import File
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from fellchensammlung.models import *
 | 
					 | 
				
			||||||
from fellchensammlung import baker_recipes
 | 
					from fellchensammlung import baker_recipes
 | 
				
			||||||
from model_bakery import baker
 | 
					from model_bakery import baker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from fellchensammlung.models import AdoptionNotice, Species, Animal, Image, ModerationAction, User, Member, Rule, Report
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Command(BaseCommand):
 | 
					class Command(BaseCommand):
 | 
				
			||||||
    help = "Populates the database with test data"
 | 
					    help = "Populates the database with test data"
 | 
				
			||||||
@@ -39,7 +40,6 @@ class Command(BaseCommand):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            animal.photos.add(image_object)
 | 
					            animal.photos.add(image_object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        rule1 = baker.make(Rule, title="Be excellent ot each other", rule_text="This is **markdown**")
 | 
					        rule1 = baker.make(Rule, title="Be excellent ot each other", rule_text="This is **markdown**")
 | 
				
			||||||
        rule2 = baker.make(Rule,
 | 
					        rule2 = baker.make(Rule,
 | 
				
			||||||
                           title="Keep al least the minimum number of animals for species",
 | 
					                           title="Keep al least the minimum number of animals for species",
 | 
				
			||||||
@@ -48,12 +48,15 @@ class Command(BaseCommand):
 | 
				
			|||||||
                           title="Rule three",
 | 
					                           title="Rule three",
 | 
				
			||||||
                           rule_text="Everything needs at least three rules")
 | 
					                           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,
 | 
					        moderation_action1 = baker.make(ModerationAction,
 | 
				
			||||||
 | 
					                                        report=report1,
 | 
				
			||||||
                                        action=ModerationAction.COMMENT,
 | 
					                                        action=ModerationAction.COMMENT,
 | 
				
			||||||
                                        public_comment="This has been seen by a moderator")
 | 
					                                        public_comment="This has been seen by a moderator")
 | 
				
			||||||
        moderation_action1 = baker.make(ModerationAction,
 | 
					        moderation_action1 = baker.make(ModerationAction,
 | 
				
			||||||
 | 
					                                        report=report1,
 | 
				
			||||||
                                        action=ModerationAction.DELETE,
 | 
					                                        action=ModerationAction.DELETE,
 | 
				
			||||||
                                        public_comment="A moderator has deleted the reported content")
 | 
					                                        public_comment="A moderator has deleted the reported content")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user