diff options
author | luxagraf <sng@luxagraf.net> | 2018-08-28 08:33:27 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-08-28 08:33:27 -0600 |
commit | 24b86512d027ee436eab6c125928b7798a6ad1bc (patch) | |
tree | 0d26a77540797fac44fbedd2745f56345d7b6f7c /app/jrnl/models.py | |
parent | 4ab532c0d6257c51e38d093fa80eb8debc6e535f (diff) | |
parent | 06cf302fa70a502f5af13738a38ddb5d32b6e79b (diff) |
Merge branch 'master' of ssh://lux2:/home/lxf/git/luxagraf
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() |