I 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