Opened 18 years ago
Closed 18 years ago
#4019 closed (duplicate)
Use default-value of model-fields as initial-value for newforms-fields
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | model default newforms field initial | |
Cc: | brosner@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I think using the default-value of a model-field as the initial value of the newsforms equivalent could be useful. So I added setting defaultsinitial in the formfield()-method of every model-fields.
As I'm not really using this the code is only tested a little, but looks working.
I did not put the code into django.newforms.models.* as I think this should be handled inside the field itself (like all other values). But perhaps some solution could be found to avoid code duplication (DRY).
Attachments (1)
Change History (3)
by , 18 years ago
Attachment: | django-use-model-default-as-newforms-initial.diff added |
---|
comment:1 by , 18 years ago
Cc: | added |
---|
comment:2 by , 18 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
I put myself on the CC list since this does effect me slightly, but I discovered this is a duplicate. I am marking this a duplicate of #899.