feat: add test photos (CC0)

This commit is contained in:
moanos [he/him] 2024-03-23 22:16:55 +01:00
parent 19e379fbc9
commit 52dfc2902a
7 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,5 @@
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User from django.core.files import File
from fellchensammlung.models import * from fellchensammlung.models import *
from fellchensammlung import baker_recipes from fellchensammlung import baker_recipes
@ -20,7 +20,7 @@ class Command(BaseCommand):
adoption1 = baker.make(AdoptionNotice, name="Vermittung1", organization=rescue1) adoption1 = baker.make(AdoptionNotice, name="Vermittung1", organization=rescue1)
adoption2 = baker.make(AdoptionNotice, name="Vermittung2", organization=rescue2) adoption2 = baker.make(AdoptionNotice, name="Vermittung2", organization=rescue2)
cat = baker.make(Species, name="Katze") cat = baker.make(Species, name="Katze")
rat = baker.make(Species, name="Farbratte") rat = baker.make(Species, name="Farbratte")
@ -29,6 +29,17 @@ class Command(BaseCommand):
rat2 = baker.make(Animal, name="Rat2", adoption_notice=adoption1, species=rat) rat2 = baker.make(Animal, name="Rat2", adoption_notice=adoption1, species=rat)
cat1 = baker.make(Animal, name="Cat1", adoption_notice=adoption2, species=cat) cat1 = baker.make(Animal, name="Cat1", adoption_notice=adoption2, species=cat)
animal_photo_combination = [(cat1, "cat1.jpeg"), (rat1, "rat1.jpg"), (rat2, "rat2.jpg")]
for animal, filename in animal_photo_combination:
image_object = Image()
image_object.alt_text = f"Picture of {animal}"
image_object.title = f"Picture of {animal}"
image_object.image.save(f"{filename}", File(open(f"./src/fellchensammlung/tests/assets/{filename}", 'rb')))
image_object.save()
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",

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB