diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2009-12-12 18:22:09 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2009-12-12 18:22:09 +0000 |
| commit | 8bb3763c2bb6ae53e2ce36c5f2ed3c3e4545c90f (patch) | |
| tree | 63d7e2fc1ffc4b6ef5b0a268301aba74cb8d28a5 /django/forms | |
| parent | c1a8bd6779c2ff907d2d80b98d79c8ab10d642ae (diff) | |
[1.1.X] 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.
r11826 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11827 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/forms.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py index 0b7c2e2338..705058a6e6 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -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): |
