Code

Opened 5 years ago

Closed 5 years ago

#11516 closed (invalid)

form improvements

Reported by: OjiiDotCh@… Owned by: nobody
Component: contrib.formtools 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

I really like how forms are handled in Django but I see a way to improve them:

Basically when a new form is sent to the user via a view, that form instance is kept saved somewhere (session?) and after the user clicks 'submit' the next page can access the filled in form via request.form. This should also support adding additional information to the form which isn't displayed or even sent to the user.

Example:

def myview(request):
    # View which displays the form to the user
    myform = SomeFormClass()
    myform.secretValue = 42
    return render_to_response('some/template/file', {'form':myform})

def myview2(request):
    # View which is called when the user 'submits' the form
    if request.form and request.form.is_valid():
        secretValue = request.form.secretValue

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by brosner

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

This adds absolutely no value to Django. If anything it is more complex due to the setup that would need to be involved. The API isn't being improved IMO. It is hiding the user from POST and FILES data which is bad. It isn't even clear how that data is even set into the form instance. I assume that is all magically handled by the middleware required to accomplish this. Magic is bad here. Let's not do it.

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.