Opened 18 years ago
Closed 18 years ago
#4694 closed (wontfix)
Custom method for Model to simplify getting formfields
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This method will simplify creating of complex forms. Now it's clear what fields belong to what models.
class BookmarkForm(Form): url = Bookmark.get_form_field('url') title = Scrapbook.get_form_field('title') description = Scrapbook.get_form_field('description')
Instead of:
class BookmarkForm(Form): url = forms.URLField(max_length=200, verify_exists=False, label=u'URL') title = forms.CharField(max_length=256, required=False, label=u'Title') description = forms.CharField(required=False, label=u'Description', widget=forms.Textinput())
If patch itself is ok, I'll write documentation and tests.
Attachments (1)
Change History (2)
by , 18 years ago
Attachment: | get_form_field.diff added |
---|
comment:1 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Thanks for the patch, but I don't think this is worth including. Putting one model after another in a form like this is only one of many cases and we can't have special methods for every case. If anybody wanted to do this, it's only one line in their code in any case.