Skip to content

Instantly share code, notes, and snippets.

@ckinsey
Created November 23, 2012 19:40
Show Gist options
  • Save ckinsey/4136999 to your computer and use it in GitHub Desktop.
Save ckinsey/4136999 to your computer and use it in GitHub Desktop.
Formset magic
class DashboardManageUsersFormset(BaseFormSet):
def __init__(self, *args, **kwargs):
self.assignment_perms = kwargs.pop('assignment_perms', None)
super(DashboardManageUsersFormset, self).__init__(*args, **kwargs)
def _construct_forms(self):
self.forms = []
for i in xrange(self.total_form_count()):
self.forms.append(self._construct_form(i, assignment_perms=self.assignment_perms))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment