TypeError Django
<p>TypeError during django project</p>

<p>Got this message on the error page:</p>

<p>TypeError at /music/1/</p>

<p>detail() got an unexpected keyword argument 'pk'</p>

<p>Request Method:     GET
Request URL:    <a href="http://127.0.0.1:8000/music/1/" rel="nofollow">http://127.0.0.1:8000/music/1/</a>
Exception Type:     TypeError</p>

<p>detail() got an unexpected keyword argument 'pk'</p>

<p>This is my music\view.detail function</p>

<pre><code>def detail(request, album_id):
    album = get_object_or_404(Album, pk=album_id)
    return render(request, 'music/detail.html', {'album':album})
</code></pre>

<p>And this is a form in my detail.html which might raise the error:</p>

<pre><code>    &lt;form action="{% url 'music:favorite' album.id %}" method="post"&gt;
    {% csrf_token %}
    {% for song in album.song_set.all %}
        &lt;!-- forloop.counter indicates how many times the for tag has gone
        through its loop --&gt;
        &lt;input type="radio" id="song{{ forloop.counter }}" name="song"
               value="{{ song.id }}"/&gt;
        &lt;label for="song{{ forloop.counter }}"&gt;
            {{ song.song_title }}
            {% if song.is_favorite %}
                &lt;img src="http://i.imgur.com/b9b13Rd.png" /&gt;
            {% endif %}
        &lt;/label&gt;&lt;br&gt;
    {% endfor %}
    &lt;input type="submit" value="Favorite"&gt;
    &lt;/form&gt;
</code></pre>

<p>And this is my urls.py</p>

<pre><code>from django.conf.urls import url
from . import views

app_name = 'music'
urlpatterns = [
    # /music/
    url(r'^$', views.index, name = 'index'),

    # /music/&lt;album_id&gt;/
    url(r'^(?P&lt;pk&gt;[0-9]+)/$', views.detail, name = 'detail'),

    # /music/&lt;album_id&gt;/favorite
    url(r'^(?P&lt;album_id&gt;[0-9]+)/favorite/$', views.favorite, name =    
'favorite'),
]
</code></pre>