Created
October 22, 2015 15:14
-
-
Save kalekseev/2c8dab448d10493a91d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_inital_data(response): | |
data = {} | |
for inline in response.context_data['inline_admin_formsets']: | |
form = inline.formset.management_form | |
for k, v in form.initial.iteritems(): | |
data[form.prefix + '-' + k] = v | |
form = response.context_data['adminform'].form | |
for field_name in form.changed_data: | |
data[field_name] = form.fields[field_name].initial | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment