X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/08e687e53ba84afd39646185142e59c6bfe77783..98062d2158ebe1f734d811691ab15e6887684281:/src/api/models.py?ds=inline diff --git a/src/api/models.py b/src/api/models.py index eb234ad8b..ffa4f9be2 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -50,6 +50,9 @@ class BookUserData(models.Model): complete = models.BooleanField(default=False) last_changed = models.DateTimeField(auto_now=True) + class Meta: + unique_together = [('user', 'book')] + @property def state(self): return 'complete' if self.complete else 'reading'