#26220: CBV: Finding template_name from form_class if it's a ModelForm
-------------------------------+--------------------
Reporter: nim65s | Owner: nobody
Type: New feature | Status: new
Component: Generic views | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
In this case, we have to set twice the model (or manually set
template_name):
{{{
class ArticleForm(ModelForm):
class Meta:
model = Article
fields = ['author', 'date']
def clean_date(self):
...
class ArticleCreateView(CreateView):
form_class = ArticleForm
model = Article # Redundant
}}}
A PoC to fix this is available here:
https://github.com/nim65s/django/commit/614dae5022bb5c7d8ad0336e17ef1e0c84b9dbbf
--
Ticket URL: <https://code.djangoproject.com/ticket/26220>
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/049.22f34926afc10cc6d2419413a2f85607%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.