diff --git a/books/models.py b/books/models.py index f9391ce..5b81ebc 100644 --- a/books/models.py +++ b/books/models.py @@ -9,7 +9,8 @@ class Book(models.Model): @property def last_updated(self): - return Chapter.objects.filter(book=self).order_by('added')[0].added + chaps=Chapter.objects.filter(book=self).order_by('added') + return chaps[0].added if chaps else None def __str__(self): return self.title