- super(ContentReferenceInlineFormSet, self).__init__(containers, data, files, instance, save_as_new, prefix, queryset)
\ No newline at end of file
+ super(ContentReferenceInlineFormSet, self).__init__(containers, data, files, instance, save_as_new, prefix, queryset)
+
+ def get_container_instances(self, containers, qs):
+ qs = qs.filter(name__in=[c[0] for c in containers])
+ container_instances = []
+ for container in qs:
+ container_instances.append(container)
+ containers.remove((container.name, container.content_type))
+ return container_instances, qs
+
+ def _construct_form(self, i, **kwargs):
+ if i >= self.initial_form_count(): # and not kwargs.get('instance'):
+ name, content_type = self.extra_containers[i - self.initial_form_count() - 1]
+ kwargs['instance'] = self.model(name=name, content_type=content_type)
+
+ return super(ContentReferenceInlineFormSet, self)._construct_form(i, **kwargs)
\ No newline at end of file