I have a doubt, what happens is that I have a list in Django and I want to use daterange, what I need is to place two dates and that fecha_registro (it is in models.py) filter the information in the same template, I only used this:
index.html
<input type="text" name="daterange" value="12/01/2021 - 12/31/2021" class="form-control"/>
base.html
$(function() {
$('input[name="daterange"]').daterangepicker({
opens: 'left'
}, function(start, end, label) {
console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
});
});
models.py
class Clientes(models.Model):
nombre = models.CharField(max_length=200)
apellido = models.CharField(max_length=200)
fecha_registro = models.DateTimeField(default=datetime.now)
def __str__(self):
return f'{self.nombre} {self.apellido}'
views.py
class list_clientes(ListView):
model=Clientes
template_name = 'Clientes/clientes-list.html'
context_object_name='clientes'
queryset=Clientes.objects.all()