==== Patch <django-make-initial-newforms-value-callable> level 1
Source: 6666b74b-a72c-0410-9b74-dd6beae1e16f:/django/make-initial-newforms-value-callable:5942 [local]
Target: bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:4993 [mirrored]
(http://code.djangoproject.com/svn/django/trunk)
Log:
r5942@damasonium: ddanier | 2007-04-12 10:08:37 +0200
* Initial value for newforms-fields may be callable now
=== django/newforms/forms.py
==================================================================
|
|
|
248 | 248 | attrs['id'] = auto_id |
249 | 249 | if not self.form.is_bound: |
250 | 250 | data = self.form.initial.get(self.name, self.field.initial) |
| 251 | if callable(data): |
| 252 | data = data() |
251 | 253 | else: |
252 | 254 | data = self.data |
253 | 255 | return widget.render(self.html_name, data, attrs=attrs) |