fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow running without CAS.
[redakcja.git]
/
src
/
cover
/
forms.py
diff --git
a/src/cover/forms.py
b/src/cover/forms.py
old mode 100755
(executable)
new mode 100644
(file)
index
513bdef
..
ea51e46
--- a/
src/cover/forms.py
+++ b/
src/cover/forms.py
@@
-1,15
+1,13
@@
-# -*- coding: utf-8 -*-
-#
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-from
StringIO import String
IO
+from
io import Bytes
IO
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _, ugettext
from cover.models import Image
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _, ugettext
from cover.models import Image
-from django.utils.
text
import mark_safe
+from django.utils.
safestring
import mark_safe
from PIL import Image as PILImage
from cover.utils import get_flickr_data, FlickrError, URLOpener
from PIL import Image as PILImage
from cover.utils import get_flickr_data, FlickrError, URLOpener
@@
-18,6
+16,7
@@
from cover.utils import get_flickr_data, FlickrError, URLOpener
class ImageAddForm(forms.ModelForm):
class Meta:
model = Image
class ImageAddForm(forms.ModelForm):
class Meta:
model = Image
+ exclude = []
def __init__(self, *args, **kwargs):
super(ImageAddForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs):
super(ImageAddForm, self).__init__(*args, **kwargs)
@@
-54,7
+53,7
@@
class ImageAddForm(forms.ModelForm):
raise forms.ValidationError(ugettext('No image specified'))
if download_url:
image_data = URLOpener().open(download_url).read()
raise forms.ValidationError(ugettext('No image specified'))
if download_url:
image_data = URLOpener().open(download_url).read()
- width, height = PILImage.open(
String
IO(image_data)).size
+ width, height = PILImage.open(
Bytes
IO(image_data)).size
else:
width, height = PILImage.open(uploaded_file.file).size
min_width, min_height = settings.MIN_COVER_SIZE
else:
width, height = PILImage.open(uploaded_file.file).size
min_width, min_height = settings.MIN_COVER_SIZE