title: django sort the query elements in a weekly monthly daily fashion
body: <p>I am getting a list of people and the tests they have taken from an api in the same project. I would like the user to have an option to see the number of tests that have taken place in a city with three options - daily/weekly/monthly.</p>
  
  <p><code>models.py</code></p>
  
  <pre><code>class City(models.Model):
      city_name=models.CharField(max_length=100,default='',blank=False)
  
  class Person(models.Model):
      title = models.CharField(max_length=3,default="mr",blank=False)
      name = models.CharField(max_length=50,default='',blank=False)
      address = models.CharField(max_length=200,default='',blank=False)
      city = models.ForeignKey(City)
  class Test(models.Model):
      person = models.ForeignKey(Person)
      date = models.DateTimeField(auto_now_add=True)
      test_name = models.CharField(max_length=200,default='',blank=False)
      subject = models.CharField(max_length=100,default='')
  </code></pre>
  
  <p>The json file for people in each city is generated like this <a href="http://pastebin.com/pYLBjrjh" rel="nofollow">http://pastebin.com/pYLBjrjh</a></p>
  
  <p>related <code>views.py</code></p>
  
  <pre><code>def personlist(request, id):
  data = requests.get('http://127.0.0.1:8000/app/cities/' + id + '/persons/').json()
  context = RequestContext(request, {
      'persons': data['results'],'count': data['count'],
  })
  
  return render_to_response('template.html', context)
  </code></pre>
  
  <p>This generates the list of names in that city that have taken the test. I want to know if there is a way to let the user select the time period.(daily/weekly/monthly) and only view the names that have taken the test in that time period.</p>