#25831: django.views.generic.edit.FormMixinBase : get_form_with_form_class
wrapping
preventing custom method profiles for get_form()
-------------------------------+--------------------------------------
Reporter: LeGast00n | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.8
Severity: Normal | Resolution:
Keywords: forms views | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by LeGast00n):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> 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()
> return get_form(self, form_class=form_class, *args,
> **kwargs)
> }}}
> cheers
New description:
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
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25831#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.f87c7052ecf9ffbeec53ee8345a71f93%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.