title: Django Foreign Key
body: <p><a href="https://i.stack.imgur.com/6H4zB.png" rel="nofollow noreferrer">Models.py</a></p>
  <p><a href="https://i.stack.imgur.com/SztWE.png" rel="nofollow noreferrer">Shell Output</a></p>
  <p>--<strong>CODE</strong>--</p>
  <pre><code>    newArtist = Artist(name= &quot;GBA&quot;,year_formed=1990)  
      newArtist.save()  
      album1 = Album(name = 'a',artist = newArtist)  
      album2 = Album(name = 'b',artist = newArtist)  
      album3 = Album(name = 'c',artist = newArtist) 
      album1.save()
      album2.save()
      album3.save()
      allAlbums = Album.objects.all()
  </code></pre>
  <p>Hey, I am pretty new to Django so have been going through the documentation diligently but have an error I for the life of me can't figure out! The problem lies when dealing with the filter property.</p>
  <p>There are 2 classes in my models file: Artist and Album. Artist is also a foreign key of Album as an Artist can have many albums. Currently I have 3 albums instances created, all saved under the Artist &quot;newArtist&quot; who's name is &quot;GBA&quot;.</p>
  <p>The problems I'm facing are<br />
  1)When attempting to filter using the artist name &quot;GBA&quot; an empty query set was returned</p>
  <p>2)However when I switched the specifier to &quot;newArtist.id&quot; it populated the query set successfully.
  Am confused as to why the artist name did not work, was it a syntactical/logic/Django rule error?</p>
  <p>If anyone needs to see further code snippets/output, please let me know.
  Thanks for your help!</p>