Skip to content
Browse files

Merge pull request #16 from jgsogo/master

Dynamic inline_model in InlineFormsetView
  • Loading branch information...
2 parents 4e5bd74 + 4860a62 commit 3a2f52e42af5717bfce0493df5b32197c678aec3 @AndrewIngram committed Mar 28, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 extra_views/formsets.py
View
5 extra_views/formsets.py
@@ -140,6 +140,9 @@ def get_context_data(self, **kwargs):
def construct_formset(self):
return self.get_formset()(instance=self.object, **self.get_formset_kwargs())
+ def get_inline_model(self):
+ return self.inline_model
+
def get_factory_kwargs(self):
kwargs = super(BaseInlineFormSetMixin, self).get_factory_kwargs()
kwargs.update({
@@ -155,7 +158,7 @@ def get_factory_kwargs(self):
return kwargs
def get_formset(self):
- return inlineformset_factory(self.model, self.inline_model, **self.get_factory_kwargs())
+ return inlineformset_factory(self.model, self.get_inline_model(), **self.get_factory_kwargs())
class InlineFormSetMixin(BaseInlineFormSetMixin, FormSetMixin, SingleObjectMixin):

0 comments on commit 3a2f52e

Please sign in to comment.
Something went wrong with that request. Please try again.