==== Patch <django-use-model-default-as-newforms-initial> level 1
Source: f4626db1-382e-0410-8594-a82d82b39f71:/use-model-default-as-newforms-initial/trunk:5026 [local]
Target: bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:5133 [mirrored]
(http://code.djangoproject.com/svn/django)
Log:
r4878@damasonium: ddanier | 2007-04-16 14:28:02 +0200
* Make model-field-default the initial value for newforms-fields
=== django/db/models/fields/__init__.py
==================================================================
|
|
|
346 | 346 | defaults = {'required': not self.blank, 'label': capfirst(self.verbose_name), 'help_text': self.help_text} |
347 | 347 | if self.choices: |
348 | 348 | defaults['widget'] = forms.Select(choices=self.get_choices()) |
| 349 | if self.has_default(): |
| 350 | defaults['initial'] = self.get_default() |
349 | 351 | defaults.update(kwargs) |
350 | 352 | return form_class(**defaults) |
351 | 353 | |