Don't copy files

parent 3ee47eb8
......@@ -7,7 +7,7 @@ from django import forms
from django.contrib import admin
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.core.files.base import File
from django.utils.translation import ugettext_lazy as _
from utils.translation import TranslatedModelAdmin
......@@ -66,7 +66,7 @@ def save_photo(request, archive_file, photo, album):
photo_obj.album = album
try:
with extract_file(photo) as f:
photo_obj.file.save(new_filename, ContentFile(f.read()))
photo_obj.file.save(new_filename, File(f))
except (OSError, AttributeError):
messages.add_message(request, messages.WARNING,
_("Ignoring {}").format(photo_filename))
......
Markdown is supported
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