Opened 15 years ago
Closed 15 years ago
#11516 closed (invalid)
form improvements
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.formtools | 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
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
Note:
See TracTickets
for help on using tickets.
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.