I'm trying to filter data through view. I tried the \_\_range and \_\_gte + \_\_lte but there are not results on the website.

model:

```
class Change(models.Model):
  def __unicode__(self):
    return unicode(self.number)
  number = models.IntegerField(verbose_name="CHG")
  service = models.ForeignKey('organization.Service')
  environment = models.CharField(choices=ENV_CHOICE, max_length=20)
  description = models.CharField(max_length=50)
  start_date = models.DateField()
  start_time = models.TimeField()
  end_date = models.DateField()
  end_time = models.TimeField()
  assignee = models.ForeignKey('organization.Assignee')

```

I tried different approach with the view:

1
=

```
def home(request):
  changes = Change.objects.all().filter(start_date__gte=datetime.date.today(), end_date__lte=datetime.date.today())
  return render(request, 'index.html', {'changes' : changes})

```

In this case when only start\_date\_\_gte is used it's working correctly but when I add the end\_date\_\_lte it does not display any records.

2
=

```
def home(request):
  today = datetime.date.today()
  changes = Change.objects.all(today__range=[start_date, end_date])
  return render(request, 'index.html', {'changes' : changes})

```

In this case I get and error global name start\_date is not defined.

Thank you very much for your help.