X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/8952b9530d943655e552ea660c47e850123c5105..a9226097c8eea0591fd3249f62a71becc6d2be93:/src/api/models.py diff --git a/src/api/models.py b/src/api/models.py index 28bc8807d..ffa4f9be2 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -6,7 +6,7 @@ from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.signals import pre_delete -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from catalogue.models import Book, Tag @@ -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'