- def set_state(self, state):
- self.complete = state == 'complete'
-
- state = property(get_state, set_state)
+ @classmethod
+ def update(cls, book, user, state):
+ instance, created = cls.objects.get_or_create(book=book, user=user)
+ instance.complete = state == 'complete'
+ instance.save()
+ return instance