Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#8494 closed (wontfix)

Instantiating ModelForm with request as kwargin ModelAdmin

Reported by: sorl Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


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 Changed 8 years ago by mtredinnick

  • milestone changed from 1.0 to post-1.0
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 8 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from new to 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.

comment:3 Changed 8 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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