Code

Opened 6 years ago

Closed 6 years ago

Last modified 5 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:

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

Attachments (0)

Change History (3)

comment:1 Changed 6 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 6 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 5 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.