+
+
+class BookUserData(models.Model):
+ book = models.ForeignKey(Book)
+ user = models.ForeignKey(User)
+ complete = models.BooleanField(default=False)
+
+ def get_state(self):
+ return 'complete' if self.complete else 'reading'
+
+ def set_state(self, state):
+ self.complete = state == 'complete'
+
+ state = property(get_state, set_state)