I have already seen all the questions about this topic but i couldnt solve my problem, my error is: "TypeError: $(...).datepicker is not a function"
Here is my code:
html
.....
<script type="text/javascript" src="{{ STATIC_URL }} /static/bootstrap/js/jquery-1.11.3.min.js">
</script>
<link rel="stylesheet" type="text/css" href="/static/bootstrap/css/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="/static/bootstrap/css/estilo.css">
<script type="text/javascript" src="{{ STATIC_URL }} /static/bootstrap/js/jquery-ui.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$('.datepicker').datepicker();
});
</script>
<div class="form-group">
<label for="nacimiento" class="control-label col-md-2">Nacimiento:</label>
<div class="col-md-8">
<input class="form-control" id="datepicker" name="nacimiento" type="text" />
</div>
</div>
....
In the html code i have all the form and every thing that let the page run... i just copy the important code for Datepicker
views.py
def registrarpaciente(request):
if request.POST:
form = PacienteForm(request.POST)
if form.is_valid():
mydate = form.cleaned_data('data_input') #I have agree this codeline just recently by looking another questions
form.save()
return render_to_response('ABME/Notificaciones/pregistrado.html')
else:
form = PacienteForm()
args = {}
args.update(csrf(request))
args['form'] = form
return render_to_response('ABME/Paciente/registrarpaciente.html', args)
form.py
from django import forms
from aplicacion.models import *
from functools import partial
DateInput = partial(forms.DateInput, {'class': 'datepicker'})
class PersonaForm(forms.ModelForm):
class Meta:
model = Persona
exclude=()
class PacienteForm(forms.ModelForm):
class Meta:
model = Paciente
data_input = forms.DateField(widget=forms.DateInput(attrs={'class':'datepicker'}))
exclude=()
I dont know if im not calling properly the widget or something, the scripts are called, i have already checked in the firebug so thats not the problem.. plz help!
