I'm sorry, I missleaded you, what you really want to use is a ModelChoiceField <https://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield> in a custom form. So you can create a form with the following code:
from django import forms class pacienteConsultasForm(forms.Form): fecha_desde = forms.DateField() fecha_hasta = forms.DateField() paciente = forms.ModelChoiceField(queryset=Paciente.objects.all()) then you use that pacienteConsultasForm class in your views.py and in your template. On Monday, December 15, 2014 2:36:08 PM UTC-3, Efe wrote: > > Hello, don't know to how configure views.py and urls.py in myapp. for > filter a list between dates from an input date in a template. > > This is my models.py: > > class Paciente(models.Model): > tipo_doc = models.ForeignKey(Tipo_doc) > num_doc = models.CharField(max_length=20, primary_key=True) > ... > class Consulta (models.Model): > numero = models.ForeignKey(Paciente) > fecha = models.DateField() > ... > > This is my file "lista.html" in templates: > > <h5> > Fecha desde: <input class="inputDate" id="fechadesde" value={{ fecha_d }} /> > Fecha hasta: <input class="inputDate" id="fechahasta" value={{ fecha_h }} /> > <a href="/clinica/filtrar_consulta" class="button">Filtrar</a></h5> > <ul class="actions"> > ... > > I need to filter the list by paciente and between 2 dates (fecha_d, > fecha_h), but I don't know how to pass parameters in url. Thank You > -- 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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/34164fc8-a945-49f9-9f24-f322abfedb3a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.