mirror of
https://github.com/django/django.git
synced 2025-07-31 00:54:37 +00:00
Fixed #11632: Fixed the id for hidden initial widget so that it is different from the id for its visible counterpart. Thanks geber@datacollect.com and Mark Lavin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ac8da7b36f
commit
9c4bd2aa33
3 changed files with 14 additions and 1 deletions
|
@ -343,6 +343,7 @@ class BoundField(StrAndUnicode):
|
|||
self.name = name
|
||||
self.html_name = form.add_prefix(name)
|
||||
self.html_initial_name = form.add_initial_prefix(name)
|
||||
self.html_initial_id = form.add_initial_prefix(self.auto_id)
|
||||
if self.field.label is None:
|
||||
self.label = pretty_name(name)
|
||||
else:
|
||||
|
@ -374,7 +375,10 @@ class BoundField(StrAndUnicode):
|
|||
attrs = attrs or {}
|
||||
auto_id = self.auto_id
|
||||
if auto_id and 'id' not in attrs and 'id' not in widget.attrs:
|
||||
attrs['id'] = auto_id
|
||||
if not only_initial:
|
||||
attrs['id'] = auto_id
|
||||
else:
|
||||
attrs['id'] = self.html_initial_id
|
||||
if not self.form.is_bound:
|
||||
data = self.form.initial.get(self.name, self.field.initial)
|
||||
if callable(data):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue