diff options
Diffstat (limited to 'app/jrnl')
-rw-r--r-- | app/jrnl/models.py | 12 | ||||
-rw-r--r-- | app/jrnl/views.py | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py index 8952eef..809353c 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -115,6 +115,16 @@ class Entry(models.Model): else: return self.image.url + def get_featured_image_thumb(self): + if self.featured_image: + return self.featured_image.get_image_by_size("tn") + else: + print(self.image.url) + image_dir, img = self.image.url.split('post-images/')[1].split('/') + print(image_dir, img) + return '%spost-images/%s/%s' % (settings.IMAGES_URL, image_dir, img) + + @property def state(self): return self.location.state @@ -179,7 +189,9 @@ class Entry(models.Model): old = type(self).objects.get(pk=self.pk) if self.pk else None if old and old.featured_image != self.featured_image: # Field has changed s = LuxImageSize.objects.get(name="featured_jrnl") + ss = LuxImageSize.objects.get(name="picwide-med") self.featured_image.sizes.add(s) + self.featured_image.sizes.add(ss) self.featured_image.save() super(Entry, self).save(*args, **kwargs) diff --git a/app/jrnl/views.py b/app/jrnl/views.py index ed8efcf..cd63482 100644 --- a/app/jrnl/views.py +++ b/app/jrnl/views.py @@ -103,7 +103,7 @@ class HomepageList(ListView): queryset = Entry.objects.filter(status__exact=1).exclude(pk=exclude.featured.pk)[:8] def get_template_names(self): - obj = HomepageCurrator.objects.get(pk=1) + obj = Home.objects.get(pk=1) return ['%s' % obj.template_name] def get_context_data(self, **kwargs): |