summaryrefslogtreecommitdiff
path: root/app/sightings
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-03-15 21:57:12 -0600
committerluxagraf <sng@luxagraf.net>2019-03-15 21:57:12 -0600
commit1274988c5fed1d8f23b244fba7408d6883d138cf (patch)
tree5c7eb0bc10553e8747cb3306fb39e54e2f00773d /app/sightings
parent7e6dcc8c6c1034496eb93ca8730a4febc105e80a (diff)
added related items complete with template and styles
Diffstat (limited to 'app/sightings')
-rw-r--r--app/sightings/models.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/sightings/models.py b/app/sightings/models.py
index 5723776..3852b1c 100644
--- a/app/sightings/models.py
+++ b/app/sightings/models.py
@@ -12,7 +12,7 @@ from django.conf import settings
from bs4 import BeautifulSoup
from locations.models import Location
-from photos.models import LuxImage
+from photos.models import LuxImage, LuxImageSize
from utils.next_prev import next_in_order, prev_in_order
from utils.util import render_images, extract_main_image, markdown_to_html
@@ -75,7 +75,7 @@ class AP(models.Model):
return self.common_name
def get_image_url(self):
- return "%s%s" % (settings.IMAGES_URL, self.image.url.split("media")[1][8:])
+ return "%s%s" % (settings.IMAGES_URL, self.image.image.url.split("media")[1][8:])
def get_absolute_url(self):
return reverse("sightings:detail", kwargs={"slug": self.slug})
@@ -121,6 +121,9 @@ class AP(models.Model):
main_image = extract_main_image(self.body_markdown)
if main_image:
self.image = main_image
+ s = LuxImageSize.objects.get(name="featured_jrnl")
+ self.image.sizes.add(s)
+ self.image.save()
self.slug = slugify(self.common_name[:50])
super(AP, self).save(*args, **kwargs)