Fixed #270 -- Admin change forms now display default values in num_extra_on_change fields with default set. Thanks for the patch, Hugo

git-svn-id: http://code.djangoproject.com/svn/django/trunk@418 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-08-06 20:51:06 +00:00
parent 8a9806096f
commit 5bb56520a5
1 changed files with 1 additions and 1 deletions

View File

@ -942,7 +942,7 @@ def change_stage(request, app_label, module_name, object_id):
if f.editable and f != rel_field: if f.editable and f != rel_field:
for field_name in f.get_manipulator_field_names(''): for field_name in f.get_manipulator_field_names(''):
full_field_name = '%s.%d.%s' % (var_name, i, field_name) full_field_name = '%s.%d.%s' % (var_name, i, field_name)
collection[field_name] = formfields.FormFieldWrapper(manipulator[full_field_name], new_data.get(full_field_name, ''), errors.get(full_field_name, [])) collection[field_name] = formfields.FormFieldWrapper(manipulator[full_field_name], new_data.get(full_field_name, f.get_default()), errors.get(full_field_name, []))
wrapper.append(formfields.FormFieldCollection(collection)) wrapper.append(formfields.FormFieldCollection(collection))
setattr(form, rel_opts.module_name, wrapper) setattr(form, rel_opts.module_name, wrapper)
if rel_opts.order_with_respect_to and rel_opts.order_with_respect_to.rel and rel_opts.order_with_respect_to.rel.to == opts: if rel_opts.order_with_respect_to and rel_opts.order_with_respect_to.rel and rel_opts.order_with_respect_to.rel.to == opts: