summaryrefslogtreecommitdiff
path: root/app/utils
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-02-07 09:54:16 -0600
committerluxagraf <sng@luxagraf.net>2019-02-07 09:54:16 -0600
commit27aaf92d26eb75157dcfa923a5d63ea63feeb98c (patch)
tree8f6213bc0ecd7738ad050dc4454732c4fd210ab1 /app/utils
parent3a54cdb85027e4a59ca6d78f5b91dbf7be77afd0 (diff)
updated stylesheets and added essays
Diffstat (limited to 'app/utils')
-rw-r--r--app/utils/util.py80
1 files changed, 42 insertions, 38 deletions
diff --git a/app/utils/util.py b/app/utils/util.py
index 714403b..6d20a54 100644
--- a/app/utils/util.py
+++ b/app/utils/util.py
@@ -58,46 +58,50 @@ def parse_image(s):
s = str(img).replace('[[base_url]]', settings.IMAGES_URL)
return s
else:
- image_id = img['id'].split("image-")[1]
- i = apps.get_model('photos', 'LuxImage').objects.get(pk=image_id)
- caption = False
- exif = False
- cluster_class = None
- is_cluster = False
- extra = None
- if cl[0] == 'cluster':
- css_class = cl[0]
- is_cluster = True
- cluster_class = cl[1]
- try:
- if cl[2] == 'caption':
+ try:
+ image_id = img['id'].split("image-")[1]
+ i = apps.get_model('photos', 'LuxImage').objects.get(pk=image_id)
+ caption = False
+ exif = False
+ cluster_class = None
+ is_cluster = False
+ extra = None
+ if cl[0] == 'cluster':
+ css_class = cl[0]
+ is_cluster = True
+ cluster_class = cl[1]
+ try:
+ if cl[2] == 'caption':
+ caption = True
+ elif cl[2] == 'exif':
+ exif = True
+ else:
+ extra = cl[2]
+
+ if len(cl) > 3:
+ if cl[3] == 'exif':
+ exif = True
+ except:
+ pass
+ elif cl[0] != 'cluster' and len(cl) > 1:
+ css_class = cl[0]
+ if cl[1] == 'caption':
caption = True
- elif cl[2] == 'exif':
+ if cl[1] == 'exif':
exif = True
- else:
- extra = cl[2]
-
- if len(cl) > 3:
- if cl[3] == 'exif':
- exif = True
- except:
- pass
- elif cl[0] != 'cluster' and len(cl) > 1:
- css_class = cl[0]
- if cl[1] == 'caption':
- caption = True
- if cl[1] == 'exif':
- exif = True
- elif cl[0] != 'cluster' and len(cl) > 2:
- css_class = cl[0]
- if cl[1] == 'caption':
- caption = True
- if cl[2] == 'exif':
- exif = True
- print('caption'+str(caption))
- else:
- css_class = cl[0]
- return render_to_string("lib/img_%s.html" % css_class, {'image': i, 'caption': caption, 'exif': exif, 'is_cluster': is_cluster, 'cluster_class': cluster_class, 'extra': extra})
+ elif cl[0] != 'cluster' and len(cl) > 2:
+ css_class = cl[0]
+ if cl[1] == 'caption':
+ caption = True
+ if cl[2] == 'exif':
+ exif = True
+ print('caption'+str(caption))
+ else:
+ css_class = cl[0]
+ return render_to_string("lib/img_%s.html" % css_class, {'image': i, 'caption': caption, 'exif': exif, 'is_cluster': is_cluster, 'cluster_class': cluster_class, 'extra': extra})
+ except KeyError:
+ ''' regular inline image, not a luximage '''
+ return str(img)
def render_images(s):