X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/08e687e53ba84afd39646185142e59c6bfe77783..a9226097c8eea0591fd3249f62a71becc6d2be93:/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'