~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wlimages/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:
6
6
from django.utils.translation import ugettext_lazy as _
7
7
from django.db import IntegrityError
8
8
from datetime import datetime
9
 
from settings import MEDIA_ROOT, MEDIA_URL
 
9
from django.conf import settings
10
10
from django.core.files.storage import FileSystemStorage
11
11
 
12
12
 
39
39
        safe_filename = storage.get_valid_name(image.name)
40
40
        im = self.create(content_type=content_type, object_id=object_id,
41
41
                         user=user, revision=1, name=image.name)
42
 
        path = '%swlimages/%s' % (MEDIA_ROOT, safe_filename)
 
42
        path = '%swlimages/%s' % (settings.MEDIA_ROOT, safe_filename)
43
43
 
44
44
        destination = open(path, 'wb')
45
45
        for chunk in image.chunks():