fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Add missing constraint.
[wolnelektury.git]
/
src
/
api
/
models.py
diff --git
a/src/api/models.py
b/src/api/models.py
index
eb234ad
..
ffa4f9b
100644
(file)
--- 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'