+ # These lines shouldn't be necessary; however, if object_ids is an EmptyQuerySet,
+ # the code (specifically the object_id__in query) won't work without them. Unclear why...
+ # TODO: is this still the case?
+ if not object_ids:
+ self.values.all().delete()
+ else:
+ self.values.exclude(object_id__in=object_ids, content_type=self.content_type).delete()
+
+ current_ids = self.object_ids
+
+ for object_id in object_ids:
+ if object_id in current_ids:
+ continue
+ self.values.create(content_type=self.content_type, object_id=object_id)
+
+ def get_value(self):
+ if self.content_type is None:
+ return None