summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/jrnl/models.py8
-rw-r--r--app/utils/widgets.py76
2 files changed, 42 insertions, 42 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index 6d55d2e..7332321 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -170,12 +170,8 @@ class Entry(models.Model):
def save(self):
if self.pk:
- if (self.pk >= 163 and self.pk != 166) or self.pk == 129:
- md = render_images(self.body_markdown)
- self.body_html = markdown_to_html(md)
- else:
- md = image_url_replace(self.body_markdown)
- self.body_html = markdown.markdown(md, extensions=['extra'], safe_mode=False)
+ md = render_images(self.body_markdown)
+ self.body_html = markdown_to_html(md)
self.has_video = parse_video(self.body_html)
try:
self.location = Location.objects.filter(geometry__contains=self.point).get()
diff --git a/app/utils/widgets.py b/app/utils/widgets.py
index 104fcdf..8e390d5 100644
--- a/app/utils/widgets.py
+++ b/app/utils/widgets.py
@@ -120,45 +120,49 @@ from django.template import Context
def parse_image(s):
soup = BeautifulSoup(s.group(), "lxml")
for img in soup.find_all('img'):
- 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':
+ if cl[0] == 'postpic' or cl[0] == 'postpicright':
+ s = str(img).replace('[[base_url]]', settings.IMAGES_URL)
+ return s
+ else:
+ image_id = img['id'].split("image-")[1]
+ i = LuxImage.objects.get(pk=image_id)
+ 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':
+ 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, '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, 'cluster_class': cluster_class, 'extra':extra})
def parse_video(s):