title: Most efficient way to query Django model by distinct groups and iterate over those subset queries
body: <p>Database is MySQL
  I am trying to iterate over all of the fields in my model by grouping them by the <code>date_created</code> field and iterating over each query. I have been able to do so but my method seems inefficient. Is there a better, cleaner way? The database is expected to reach north of 50,000 rows with unique dates up to and past a year long. I plan on doing intricate work within each query of <code>date_created</code> sub queries and will need access to other fields in the model. I plan on using the data mostly to display charts and stuff on a webpage using Django and Heroku.</p>
  
  <pre><code>    data = model.objects.all()
  
      distinct_dates = data.values('date_created').distinct()
  
      for each_date in distinct_dates:
          data.filter(date_created=each_date['date_created'])
  </code></pre>
  
  <p>The values of <code>each_date</code> would be each unique date associated with the model and that field</p>
  
  <p>Here is my model</p>
  
  <pre><code>class Model(models.Model):
      expansion = models.CharField(max_length=255, default='', db_index=True)
      value = models.DecimalField(max_digits=12, decimal_places=2, default=0)
      date_created = models.DateField(db_index=True)
  
      class Meta:
          ordering = ['date_created', ]
  </code></pre>