diff options
author | lxf <sng@luxagraf.net> | 2022-05-13 17:32:45 -0400 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2022-05-13 17:32:45 -0400 |
commit | c9a07e37189bec38f8951bd50ae5ec74318d60e4 (patch) | |
tree | ea22e71c6e299cdead2b9a03d36b1b2708a6f4ef /app/lttr | |
parent | 2b309b3828fd6bc70770b0aa5174b1a9c0640169 (diff) |
lttr: made newsletter count automatically increment
Diffstat (limited to 'app/lttr')
-rw-r--r-- | app/lttr/models.py | 6 |
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) |