X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/08e687e53ba84afd39646185142e59c6bfe77783..031b8be3bf03baa724dd7e225b0555726d089341:/src/api/models.py 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'