#8494 closed (wontfix)
Instantiating ModelForm with request as kwargin ModelAdmin
Reported by: | sorl | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
May I propose instantiating the ModelForm with request as kwarg in add_view, change_view in ModelAdmin class. This would allow the form, fields to be customized and validated on a per user basis.
-form = ModelForm(request.POST, request.FILES)
+form = ModelForm(request.POST, request.FILES, request=request)
Perhaps also the FormSet
Change History (3)
comment:1 by , 16 years ago
milestone: | 1.0 → post-1.0 |
---|
comment:2 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
ModelAdmin.get_form()
receives the request (and, for object-level change requests, also the object) and is expected to return a Form
subclass to use, and overriding that is how you should do per-user or per-request form tweaks.
This is a feature request. No way is it 1.0 material.