From 19584a13620e75712bf6b6996891c0ddbe3b53bc Mon Sep 17 00:00:00 2001
From: Jorran de Wit <jorrandewit@outlook.com>
Date: Thu, 23 Mar 2017 21:27:19 +0100
Subject: [PATCH] Code for last commit

---
 journals/models.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/journals/models.py b/journals/models.py
index 9646853c6..d858d6bcc 100644
--- a/journals/models.py
+++ b/journals/models.py
@@ -169,6 +169,10 @@ class IssueManager(models.Manager):
                               until_date__gte=timezone.now(),
                               **kwargs).order_by('-until_date').first()
 
+    def get_last_filled_issue(self, *args, **kwargs):
+        return self.published(publication__isnull=False,
+                              **kwargs).order_by('-until_date').first()
+
 
 class Issue(models.Model):
     in_volume = models.ForeignKey(Volume, on_delete=models.CASCADE)
@@ -199,6 +203,10 @@ class Issue(models.Model):
             return (' (' + self.start_date.strftime('%B') + '-' + self.until_date.strftime('%B') +
                     ' ' + self.until_date.strftime('%Y') + ')')
 
+    def is_current(self):
+        return self.start_date <= timezone.now().date() and\
+               self.until_date >= timezone.now().date()
+
     def period(self):
         text = 'up to {{ until_month }} {{ year }}'
         template = Template(text)
-- 
GitLab