There are an awful lot of date/datetime picker implementations out there. Are there any that integrate with Django and Crispy Forms particularly well, and how are they used?
My solution is simple and uses the datetimepicker from https://eonasdan.github.io/bootstrap-datetimepicker/.
Include the css file:
Include the js files:
Define a css class for the field in the form (works with Crispy too):
class MyForm(forms.ModelForm):
class Meta:
model = MyModelo
fields = ['a','b','c']
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
self.fields['a'].widget.attrs['class'] = 'datepicker'
In the template include a JQuery function linking to the css class:
This solution works great with Django 1.10, Crispy Forms and Django Model Forms.