mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
SAS fixes
This commit is contained in:
parent
7969e9ba5f
commit
7f0561234f
@ -1086,10 +1086,10 @@ def migrate_sas():
|
|||||||
file_name += "/" + str(r['id_photo']) + ".jpg"
|
file_name += "/" + str(r['id_photo']) + ".jpg"
|
||||||
|
|
||||||
file = File(open(file_name, "rb"))
|
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(
|
p = Picture(
|
||||||
name=(to_unicode(str(r['id_photo'])) + ".jpg").encode('utf-8'),
|
name=str(r['id_photo']) + ".jpg",
|
||||||
owner=user,
|
owner=user,
|
||||||
is_moderated=True,
|
is_moderated=True,
|
||||||
is_folder=False,
|
is_folder=False,
|
||||||
|
@ -17,9 +17,11 @@ class Picture(SithFile):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_vertical(self):
|
def is_vertical(self):
|
||||||
im = Image.open(BytesIO(self.file.read()))
|
with open(settings.MEDIA_ROOT + self.file.name).encode('utf-8'), 'rb') as f:
|
||||||
(w, h) = im.size
|
im = Image.open(BytesIO(f.read()))
|
||||||
return (w / h) < 1
|
(w, h) = im.size
|
||||||
|
return (w / h) < 1
|
||||||
|
return False
|
||||||
|
|
||||||
def can_be_edited_by(self, user):
|
def can_be_edited_by(self, user):
|
||||||
return user.is_in_group(settings.SITH_SAS_ADMIN_GROUP_ID)
|
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>
|
<a href="{{ url('sas:album_edit', album_id=album.id) }}">{% trans %}Edit{% endtrans %}</a><br>
|
||||||
<hr>
|
<hr>
|
||||||
<div>
|
<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">
|
<a href="{{ url("sas:album", album_id=a.id) }}" style="display: inline-block">
|
||||||
<div class="album">
|
<div class="album">
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
Reference in New Issue
Block a user