Django

Code

Ticket #4019 (closed: duplicate)

Opened 2 years ago

Last modified 2 years ago

Use default-value of model-fields as initial-value for newforms-fields

Reported by: David Danier <goliath.mailinglist@gmx.de> Assigned to: adrian
Milestone: Component: Forms
Version: SVN Keywords: model default newforms field initial
Cc: brosner@gmail.com Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

django-use-model-default-as-newforms-initial.diff (6.3 kB) - added by David Danier <goliath.mailinglist@gmx.de> on 04/12/07 03:47:50.

Change History

04/12/07 03:47:50 changed by David Danier <goliath.mailinglist@gmx.de>

  • attachment django-use-model-default-as-newforms-initial.diff added.

04/12/07 19:02:33 changed by brosner <brosner@gmail.com>

  • cc set to brosner@gmail.com.
  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

04/13/07 01:09:52 changed by Brian Rosner <brosner@gmail.com>

  • status changed from new to closed.
  • resolution set to duplicate.

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.


Add/Change #4019 (Use default-value of model-fields as initial-value for newforms-fields)




Change Properties
Action