I've been trying to get the jquery datepicker to work on django, I've looked at Show datepicker but I've had no luck.
My Date is defined as
date = models.DateTimeField('Published Date')
My date in the form is setup as:
class UploadForm(forms.ModelForm):
class Meta:
model = Archive
widgets = {
'date': forms.DateInput(attrs={'class': 'datepicker'}),
}
In My upload.html
{% extends 'budget/base_form_views.html' %}
<script>
$(function() {
$('.datepicker').datepicker({
changeMonth:true,
changeYear: true,
yearRange: 1900:2100,})
});
</script>
//generated form//
The upload.html extends base_form.html and all the scripts are loaded there
<head>
<script type="text/javascript" src="{% static 'budget/js/jquery-1.10.2.js' %}"></script>
<script type="text/javascript" src="{% static 'budget/js/jquery-ui-1.10.4.custom.js' %}"></script>
<script type="text/javascript" src="{% static 'budget/js/bootstrap.js' %}"></script>
<link rel="stylesheet" type="text/css" href="{% static 'budget/css/jquery-ui.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'budget/css/bootstrap.css' %}" />
</head>
Nothing happends when I click on the date text field, In the firefox console, all scripts and css's get load with no errors.
I'm using Django 1.6.5.
Is there something that I'm missing?
edit: forgot to add Upload View to post.
class UploadView(FormView):
template_name = "budget/upload.html"
form_class = UploadForm
success_url = reverse_lazy('view')