Calling datepicker from a FormHelper - Using CrispyForms

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Calling datepicker from a FormHelper - Using CrispyForms

chevalier
I am trying to call my JQuery datepicker from a FormHelper. I just can't find a way to send attributes to JQuery e.g "theme":"dark" etc. This is important for me because i want to define the format type also.

class DeviceFilterFormHelper(FormHelper):


 form_id
= "Device-search-form"
 form_method
= "GET"
 form_tag
= True
 html5_required
= True
 
 layout
= Layout(
 
Div(
 
Div('name', css_class="col-md-6"),
 
Div('location', css_class="col-md-6"),
 css_class
='row'
 
),
 
Div(
 
Div('phone_number', css_class="col-md-6"),
 
Div(Field('updated_date', css_class="date-time-picker", // this is field in which i want to call my attrs which i can't find a way to call
 attrs
={
 
'required': True,
 
'theme': 'dark',
 
'class': 'date-time-picker',
 
'data-options': '{"format":"Y-m-d H:i", "timepicker":"true"}'

 
})),
 css_class
='row'
 
),
 
FormActions(
 
Submit("submit", ("Search"), css_class="col-md-5"),
 css_class
="col-8 text-right align-self-center",
 
),
 
)




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ee8efd70-df4b-49c6-a268-da096a317567%40googlegroups.com.