title: django - Get the set of objects from Many To One relationship
body: <p>Please have a look at these models:</p>
  
  <pre><code>class Album(models.Model):
      user = models.ForeignKey(User)
      name = models.CharField(max_length=200)
      pub_date = models.DateTimeField(default=datetime.now)
  
  
  class Photo(models.Model):
      album = models.ForeignKey(Album, default=3)
      image = models.ImageField(upload_to=get_upload_file_name)
      caption = models.CharField(max_length=200)
      pub_date = models.DateTimeField(default=datetime.now)
  </code></pre>
  
  <p>How do I get the the set of photos for a particular album??? And how to get the <strong>Album</strong> from the <strong>photo</strong> <em>instance</em> itself?</p>
  
  <p>I tried this:</p>
  
  <pre><code># To get the set of photos from the user (tika) album:
  &gt;&gt;&gt;t = User.objects.get(username='tika')
  &gt;&gt;&gt;t_album = Album.objects.get(user=t)
  &gt;&gt;&gt;t_album 
  &lt;Album: tika_album&gt;
  &gt;&gt;&gt;t_album.image_set.all()
  AttributeError: 'Album' Object has no attribute 'image_set'
  </code></pre>
  
  <p>Please guide me to the right direction. Thank you.</p>