Commit f7119541 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'requirements-update' into 'master'

Update requirements and fix icon generation in fixtures

See merge request !688
parents 0bf09c4c c15d1510
......@@ -2,4 +2,4 @@ tox
flake8
factory_boy>=2.9.2
Faker>=0.8.3
git+https://github.com/azaghal/pydenticon
pydenticon>=0.3.1
Django>=2.0,<2.1
django-localflavor>=1.6,<1.7
Pillow>=4.3.0,<4.5.0
django-localflavor>=2.0,<2.1
Pillow>=5.0,<5.1
django-compressor>=2.1,<3
django-sendfile<=0.4
freezegun>=0.3.9,<0.4.0
django-template-check>=0.3.0 # This should be in dev-requirements somehow
bleach>=2.1.0,<2.2
django-tinymce4-lite>=1.6,<1.7
django-tinymce4-lite>=1.7,<1.8
rcssmin>=1.0.6
djangorestframework>=3.7.1,<3.8
django-ical>=1.4,<2
......
import math
import random
import string
import tempfile
from datetime import date, timedelta
from django.contrib.auth.models import User
from django.core.files import File
from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand
from django.utils import timezone
......@@ -96,12 +95,12 @@ class Command(BaseCommand):
board.description_en = faker.paragraph()
igen = IconGenerator(5, 5) # 5x5 blocks
icon = igen.generate(board.name_nl, 480, 480, (
10, 10, 10,
10)) # 620x620 pixels, with 10 pixels padding on each side
with tempfile.TemporaryFile() as tfile:
tfile.write(icon)
board.photo.save(board.name_nl + '.png', File(tfile))
icon = igen.generate(
board.name_nl, 480, 480,
padding=(10, 10, 10, 10),
output_format='jpeg',
) # 620x620 pixels, with 10 pixels padding on each side
board.photo.save(board.name_nl + '.jpeg', ContentFile(icon))
board.since = date(year=lecture_year, month=9, day=1)
board.until = date(year=lecture_year+1, month=8, day=31)
......@@ -130,12 +129,12 @@ class Command(BaseCommand):
committee.description_en = faker.paragraph()
igen = IconGenerator(5, 5) # 5x5 blocks
icon = igen.generate(committee.name_nl, 480, 480, (
10, 10, 10,
10)) # 620x620 pixels, with 10 pixels padding on each side
with tempfile.TemporaryFile() as tfile:
tfile.write(icon)
committee.photo.save(committee.name_nl + '.png', File(tfile))
icon = igen.generate(
committee.name_nl, 480, 480,
padding=(10, 10, 10, 10),
output_format='jpeg',
) # 620x620 pixels, with 10 pixels padding on each side
committee.photo.save(committee.name_nl + '.jpeg', ContentFile(icon))
committee.since = faker.date_time_between("-10y", "+30d")
......@@ -234,12 +233,12 @@ class Command(BaseCommand):
partner.link = faker.uri()
igen = IconGenerator(5, 5) # 5x5 blocks
icon = igen.generate(partner.name, 480, 480, (
10, 10, 10,
10)) # 620x620 pixels, with 10 pixels padding on each side
with tempfile.TemporaryFile() as tfile:
tfile.write(icon)
partner.logo.save(partner.name + '.png', File(tfile))
icon = igen.generate(
partner.name, 480, 480,
padding=(10, 10, 10, 10),
output_format='jpeg',
) # 620x620 pixels, with 10 pixels padding on each side
partner.logo.save(partner.name + '.jpeg', ContentFile(icon))
partner.address = faker.street_address()
partner.zip_code = faker.postcode()
......@@ -275,13 +274,13 @@ class Command(BaseCommand):
profile.website = fakeprofile['website'][0]
igen = IconGenerator(5, 5) # 5x5 blocks
icon = igen.generate(user.username, 480, 480, (
10, 10, 10, 10
)) # 620x620 pixels, with 10 pixels padding on each side
with tempfile.TemporaryFile() as tfile:
tfile.write(icon)
profile.photo.save(fakeprofile['username'] + '.png',
File(tfile))
icon = igen.generate(
user.username, 480, 480,
padding=(10, 10, 10, 10),
output_format='jpeg',
) # 620x620 pixels, with 10 pixels padding on each side
profile.photo.save(fakeprofile['username'] + '.jpeg',
ContentFile(icon))
membership = Membership()
membership.user_id = user.id
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment