#11632: default=datetime.datetime.now in ModelField creates dublicate HTML-IDs 
in
ModelForm
-----------------------------------+----------------------------------------
 Reporter:  [email protected]  |       Owner:  nobody    
   Status:  new                    |   Milestone:            
Component:  Forms                  |     Version:  1.1       
 Keywords:                         |       Stage:  Unreviewed
Has_patch:  0                      |  
-----------------------------------+----------------------------------------
 When you have a model like this:

 {{{

 class MyModel(models.Model):
     datetime = models.TimestampField(_('Affected Time Start'),
 default=datetime.datetime.now)
 }}}


 And a Form like this:


 {{{
 class MyModelForm(forms.ModelForm):
     class Meta:
         model = MyModel
         fields = ('datetime',)
 }}}

 The generated HTML (in my case with prefix=2) looks like that:


 {{{
 <input type="text" name="2-datetime" value="2009-08-04 11:13:40"
 id="id_2-datetime" /><input type="hidden" name="initial-2-datetime"
 value="2009-08-04 11:13:40.694547" id="id_2-datetime" />
 }}}

 Obviously, the HTML ID is the same in the hidden field, which causes some
 JS-trouble.

 Hope you'll fix it soon.

 Cheers.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11632>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to