Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#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 Malcolm Tredinnick, 16 years ago

milestone: 1.0post-1.0

This is a feature request. No way is it 1.0 material.

comment:2 by James Bennett, 16 years ago

Resolution: wontfix
Status: newclosed

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.

comment:3 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top