Skip to content

Commit 44bc4dd

Browse files
committed
test: add allies fixtures
1 parent 54b9a07 commit 44bc4dd

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

apps/dev/management/commands/dbload.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from django.conf import settings
55
from django.core.files.uploadedfile import UploadedFile
66
from django.core.management.base import BaseCommand
7+
from apps.about.models import Ally
78

89
from apps.locations.models import Venue
910
from apps.organizations.models import Organization
@@ -52,6 +53,34 @@ def add_own_organization():
5253
).save()
5354

5455

56+
def add_allies():
57+
"""
58+
Add the Python Canarias allies, in order to work with this section
59+
"""
60+
print("Adding allies")
61+
62+
photo_path = Path(settings.BASE_DIR) / 'apps/dev/fixtures/fancy_venue.jpg'
63+
with photo_path.open('rb') as fin:
64+
photo = UploadedFile(fin, name=photo_path.name)
65+
Ally(
66+
name='Ally 1',
67+
description='El aliado 1 es el mejor del mundo',
68+
logo=photo,
69+
url='mywebsite.com',
70+
twitter='https://twitter.com/elonmusk',
71+
email='some.mail@domain.com',
72+
).save()
73+
74+
Ally(
75+
name='Ally 2',
76+
description='El aliado 2 no es malo pero no fue el primero',
77+
logo=photo,
78+
url='https://www.anotherwebsite.com',
79+
twitter='https://twitter.com/Marvel',
80+
email='marvel@domain.com',
81+
).save()
82+
83+
5584
def add_events():
5685
"""
5786
Add a sample value and event so we get some content in the events page
@@ -98,3 +127,4 @@ def handle(self, *args, **options):
98127
add_own_organization()
99128
add_quotes()
100129
add_events()
130+
add_allies()

0 commit comments

Comments
 (0)