~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlscreens/models.py

  • Committer: kaputtnik
  • Date: 2019-03-31 11:08:21 UTC
  • mto: This revision was merged to the branch mainline in revision 531.
  • Revision ID: kaputtnik-20190331110821-1o6c8ebh1sag7xat
mv main files into mainpage directory; apply needed changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile
8
8
from django.core.files.storage import FileSystemStorage
9
9
import os
10
 
from settings import THUMBNAIL_SIZE, MEDIA_ROOT
 
10
from django.conf import settings
11
11
from django.urls import reverse
12
12
 
13
13
 
21
21
        # If the filename already exists, remove it as if it was a true file
22
22
        # system
23
23
        if self.exists(name):
24
 
            os.remove(os.path.join(MEDIA_ROOT, name))
 
24
            os.remove(os.path.join(settings.MEDIA_ROOT, name))
25
25
        return name
26
26
 
27
27
 
80
80
        if image.mode not in ('L', 'RGB'):
81
81
            image = image.convert('RGB')
82
82
 
83
 
        image.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS)
 
83
        image.thumbnail(settings.THUMBNAIL_SIZE, Image.ANTIALIAS)
84
84
 
85
85
        # Save the thumbnail
86
86
        temp_handle = StringIO()