title: Django: how to get related foreign key set?
body: <p>I'm working in Django 1.8. I have models like this:</p>
  
  <pre><code>class School(models.Model):
      code = models.CharField(primary_key=True)
      name = models.CharField(max_length=200)
  
      class Meta:
          app_label = 'frontend'
  
  class SchoolStatusOnDate(models.Model):
      school = models.ForeignKey(School)
      date = models.DateField()
      setting = models.IntegerField()
  </code></pre>
  
  <p>I want to retrieve all the statuses associated with a particular school, and I think I should be able to do it <a href="https://docs.djangoproject.com/en/1.8/topics/db/examples/many_to_one/" rel="noreferrer">using <code>_set</code> as described here</a>, but it isn't working. This is my code:</p>
  
  <pre><code>s = School.objects.filter(code='A81018')
  now = datetime.datetime.now()
  SchoolStatusOnDate.objects.create(school=s, date=now, setting=4)
  print s.schoolStatusOnDate_set.all()
  </code></pre>
  
  <p>But this gives me the following error on the final line: </p>
  
  <pre><code>AttributeError: 'School' object has no attribute 'schoolStatusOnDate_set'
  </code></pre>
  
  <p>What am I doing wrong?</p>