Hello Torsten,
I just looked for a way to assign different classes for this widget.
Thank you for this code sample.

On 21 июл, 14:28, Torsten Bronger <[EMAIL PROTECTED]>
wrote:
> Hallöchen!
>
> I wanted to have those neat Javascript functions with my
> DateTimeField that Django's admin facility offers.  However, the
> only way I found to achieve this was:
>
> class MyModelForm(ModelForm):
>     def __init__(self, data=None, **keyw):
>         super(MyModelForm, self).__init__(data, **keyw)
>         split_widget = forms.SplitDateTimeWidget()
>         split_widget.widgets[0].attrs = {'class': 'vDateField'}
>         split_widget.widgets[1].attrs = {'class': 'vTimeField'}
>         self.fields["timestamp"].widget = split_widget
>     class Meta:
>         model = models.MyModel
>
> Thus, I inject different attributes into the child widgets of a
> SplitDateTimeWidget in oder to activate the Javascript.  Is there a
> more straightforwand way for getting different attributes into a
> "multi-widget"?
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>                    Jabber ID: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to