Commit 7f056123 authored by Skia's avatar Skia

SAS fixes

parent 7969e9ba
Pipeline #438 failed with stage
in 2 minutes and 3 seconds
......@@ -1086,10 +1086,10 @@ def migrate_sas():
file_name += "/" + str(r['id_photo']) + ".jpg"
file = File(open(file_name, "rb"))
file.name = (str(r['id_photo']) + ".jpg").encode('utf-8')
file.name = str(r['id_photo']) + ".jpg"
p = Picture(
name=(to_unicode(str(r['id_photo'])) + ".jpg").encode('utf-8'),
name=str(r['id_photo']) + ".jpg",
owner=user,
is_moderated=True,
is_folder=False,
......
......@@ -17,9 +17,11 @@ class Picture(SithFile):
@property
def is_vertical(self):
im = Image.open(BytesIO(self.file.read()))
(w, h) = im.size
return (w / h) < 1
with open(settings.MEDIA_ROOT + self.file.name).encode('utf-8'), 'rb') as f:
im = Image.open(BytesIO(f.read()))
(w, h) = im.size
return (w / h) < 1
return False
def can_be_edited_by(self, user):
return user.is_in_group(settings.SITH_SAS_ADMIN_GROUP_ID)
......
......@@ -18,7 +18,7 @@
<a href="{{ url('sas:album_edit', album_id=album.id) }}">{% trans %}Edit{% endtrans %}</a><br>
<hr>
<div>
{% for a in album.children.filter(is_folder=True, is_moderated=True).all() %}
{% for a in album.children.filter(is_folder=True, is_moderated=True).order_by('-id') %}
<a href="{{ url("sas:album", album_id=a.id) }}" style="display: inline-block">
<div class="album">
<div>
......
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