diff options
author | luxagraf <sng@luxagraf.net> | 2020-08-06 22:15:07 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-08-06 22:15:07 -0400 |
commit | d757203bae35697b739e177183ada7198c495d52 (patch) | |
tree | 32eb2d74748f845d67dab7465f283fc4a0a95968 /app/posts | |
parent | b21ee9e325cd71e2061222b06b7929068bdb79ae (diff) |
fixed a save bug in posts model
Diffstat (limited to 'app/posts')
-rw-r--r-- | app/posts/models.py | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/app/posts/models.py b/app/posts/models.py index 226f91b..dea8306 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -166,27 +166,14 @@ class Post(models.Model): self.featured_image.sizes.add(s) self.featured_image.sizes.add(ss) self.featured_image.save() - super(Post, self).save(*args, **kwargs) - - - try: - 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: # 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() if old.title != self.title or old.slug != self.slug: related, c = RelatedPost.objects.get_or_create(model_name=self.get_content_type(), entry_id = self.id, pub_date=self.pub_date) related.title = self.title related.slug = self.slug related.save() + super(Post, self).save(*args, **kwargs) + + class PostModerator(CommentModerator): |