summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/lttr/models.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/lttr/models.py b/app/lttr/models.py
index a1a0c70..b4d1506 100644
--- a/app/lttr/models.py
+++ b/app/lttr/models.py
@@ -225,6 +225,7 @@ class NewsletterMailing(models.Model):
class Meta:
ordering = ('-pub_date', '-newsletter')
+ get_latest_by = "pub_date"
def __str__(self):
return self.title
@@ -248,7 +249,10 @@ class NewsletterMailing(models.Model):
self.body_markdown = self.post.body_markdown
self.pub_date = self.post.pub_date
self.featured_image = self.post.featured_image
- self.issue = self.post.issue
+ if self.post.issue:
+ self.issue = self.post.issue
+ else:
+ self.issue = NewsletterMailing.objects.filter(newsletter=self.newsletter).latest().issue+1
if not created:
md = render_images(self.body_markdown)
self.body_html = markdown_to_html(md)