Opened 10 years ago
Last modified 10 years ago
#25831 closed Bug
django.views.generic.edit.FormMixinBase : get_form_with_form_class wrapping preventing custom method profiles for get_form() — at Version 1
| Reported by: | LeGast00n | Owned by: | nobody |
|---|---|---|---|
| Component: | Generic views | Version: | 1.8 |
| Severity: | Normal | Keywords: | forms views |
| Cc: | Simon Charette | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
Hi there,
Django 1.8's FormMixinBase causes an issue for Views that implement a custom method profile for get_form() : the wrapping function tolerates no other argument than form_class.
Current implementation:
def get_form_with_form_class(self, form_class=None):
if form_class is None:
form_class = self.get_form_class()
return get_form(self, form_class=form_class)
Better implementation:
def get_form_with_form_class(self, form_class=None, *args, **kwargs):
if form_class is None:
form_class = self.get_form_class(*args, **kwargs)
return get_form(self, form_class=form_class, *args, **kwargs)
cheers
Note:
See TracTickets
for help on using tickets.