#16502: CreateView useless error message when template_name is not specified -------------------------------------+------------------------------------- Reporter: silverghost3@… | Owner: aaugustin Type: Bug | Status: new Component: Generic views | Version: master Severity: Normal | Resolution: Keywords: CreateView "generic | Triage Stage: Accepted view" | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 1 Needs tests: 0 | UI/UX: 0 Easy pickings: 1 | -------------------------------------+-------------------------------------
Comment (by bhuztez): > I don't like the way this patch/pull request works with ModelForms - it magically extracts a model from a ModelForm, which already needs discussion as it's new behaviour Yes, but it is not a new behaviour, the function-based generic view counterpart did the same magic. I did not know whether or not the design decision had been changed to not providing a default `template_name`. To provide a default `template_name`, I don't think there is a much less magical way , given current ModelForm API. https://github.com/django/django/blob/stable/1.4.x/django/views/generic/create_update.py#L29 > but even worse it then passes that model out and then makes a brand new ModelForm out of it - that shouldn't happen. No, it does not. If `form_class` already exists, it will NOT make a new `ModelForm` from `model` extracted from that, it will just return `form_class` you defined. The function-based generic view counterpart did the same. -- Ticket URL: <https://code.djangoproject.com/ticket/16502#comment:17> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.