Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics Test Time Django TDD

Not all tests passing

Can someone explain to me what's wrong with my code ? why aren't all tests passing ?

songs/models.py
from django.db import models

# Write your models here
class Song(models.Model):

    title = models.CharField(max_length=255)
    artist = models.CharField(max_length=255)
    length = models.IntegerField(default=0)
    performer = models.ForeignKey("Performer")

    def __str__(self):
        return '{} by {}'.format(self.title, self.artist)


class Performer(models.Model):
    name = models.CharField(max_length=255)

    def __str__(self):
        return self.name
songs/views.py
def performer_detail(request, pk):
    performer = get_object_or_404(Performer, pk=pk)
    # Add missing songs
    songs = Song.objects.filter(performer=performer)
    # Add songs to template context
    return render(request, 'songs/performer_detail.html', {'performer': performer, 'songs': songs})
songs/templates/songs/performer_detail.html
{% extends 'base.html' %}

{% block title %}{{ performer.name }}{% endblock %}

{% block content %}
  {# removed link #}
  {#<h2><a href="{% url 'songs:detail' pk=performer.song.pk %}">{{ performer.song.title }}</a></h2>#}
  <h2>{{ performer }}</h2>#}
  {# Add loop to list songs #}
  {% for song in songs %}
   {{ song }}
  {% endfor %}
{% endblock %}