Skip to content

Commit

Permalink
Merge pull request #3 from crodriguezgarci/feature/filter_form_data
Browse files Browse the repository at this point in the history
Filter form data to include only form fields data
  • Loading branch information
crodriguezgarci authored Jul 21, 2021
2 parents 9c7e5e8 + 065cc27 commit d03c9a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion django_remote_forms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ def as_dict(self):

initial_data[name] = form_dict['fields'][name]['initial']

form_data = self.form.data.copy()

# Filter data to include only form fields data
form_data = {k: v for k, v in self.form.data.items() if k in list(self.fields)}

if self.form.data:
form_dict['data'] = self.form.data
form_dict['data'] = form_data
else:
form_dict['data'] = initial_data

Expand Down

0 comments on commit d03c9a2

Please sign in to comment.