- if value is None:
- self.object_ids = ""
- return
- if not isinstance(value, models.query.QuerySet):
- raise TypeError("Value must be a QuerySet.")
- self.content_type = ContentType.objects.get_for_model(value.model)
- self.object_ids = ','.join([`value` for value in value.values_list('id', flat=True)])
+ # Value is probably a queryset - but allow any iterable.
+ if isinstance(value, models.query.QuerySet):
+ value = value.values_list('id', flat=True)
+
+ self.object_ids = ','.join([str(v) for v in value])