diff options
Diffstat (limited to 'app/posts')
-rw-r--r-- | app/posts/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/posts/models.py b/app/posts/models.py index 31e96b0..196c941 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -168,7 +168,10 @@ class Post(models.Model): except Location.DoesNotExist: raise forms.ValidationError("There is no location associated with that point, add it: %sadmin/locations/location/add/" % (settings.BASE_URL)) if created and not self.featured_image: - self.featured_image = LuxImage.objects.latest() + if self.post_type == PostType.FIELD_NOTE: + self.featured_image = extract_main_image(self.body_markdown) + else: + self.featured_image = LuxImage.objects.latest() 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") |