diff options
Diffstat (limited to 'app/jrnl/models.py')
-rw-r--r-- | app/jrnl/models.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py index 522764d..6dab4b9 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -174,8 +174,10 @@ class Entry(models.Model): self.location = Location.objects.filter(geometry__contains=self.point).get() 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() old = type(self).objects.get(pk=self.pk) if self.pk else None - if old and old.featured_image != self.featured_image or created: # Field has changed + if old and old.featured_image != self.featured_image: # Field has changed s = LuxImageSize.objects.get(name="featured_jrnl") self.featured_image.sizes.add(s) self.featured_image.save() |