summaryrefslogtreecommitdiff
path: root/app/utils
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2016-11-13 09:22:49 -0500
committerluxagraf <sng@luxagraf.net>2016-11-13 09:22:49 -0500
commit0bf00ae0c85821d5ffeb75bc8dd982d1b423d2aa (patch)
tree8f2ba746eee5919f986e6934a40f9cf5c14587f2 /app/utils
parent879fbe18d39fef0021c133f59523d3e050be5c73 (diff)
fixed some image insert bugs, added image id
Diffstat (limited to 'app/utils')
-rw-r--r--app/utils/widgets.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/utils/widgets.py b/app/utils/widgets.py
index f045cee..d588b08 100644
--- a/app/utils/widgets.py
+++ b/app/utils/widgets.py
@@ -120,14 +120,15 @@ from django.template import Context
def parse_image(s):
soup = BeautifulSoup(s.group(), "lxml")
for img in soup.find_all('img'):
- src = img['src'].split("images/")[1]
- i = LuxImage.objects.get(image__icontains=src)
+ image_id = img['id'].split("image-")[1]
+ i = LuxImage.objects.get(pk=image_id)
cl = img['class']
caption = False
exif = False
cluster_class = None
extra = None
if cl[0] == 'cluster':
+ css_class = cl[0]
cluster_class = cl[1]
try:
if cl[2] == 'caption':
@@ -142,13 +143,13 @@ def parse_image(s):
exif = True
except:
pass
- if len(cl) > 1:
+ elif cl[0] != 'cluster' and len(cl) > 1:
css_class = cl[0]
if cl[1] == 'caption':
caption = True
if cl[1] == 'exif':
exif = True
- if len(cl) > 2:
+ elif cl[0] != 'cluster' and len(cl) > 2:
css_class = cl[0]
if cl[1] == 'caption':
caption = True