title: django.urls.exceptions.NoReverseMatch: Reverse for 'favorite' not found
body: <p>Django version 2.0</p>
  
  <p>views.py</p>
  
  <pre><code>from django.views import generic
  from .models import Album
  
  
  class IndexView(generic.ListView):
      template_name = 'music/index.html'
      context_object_name = 'all_albums'
  
      def get_queryset(self):
          return Album.objects.all()
  
  class DetailView(generic.DetailView):
      model = Album
      template_name = 'music/details.html'
  </code></pre>
  
  <p>details.html</p>
  
  <pre><code>{% extends 'music/base.html' %}
  
  {% block body %}
  
      &lt;!-- {{album}} --&gt;
  
      &lt;img src="{{album.album_logo}}"&gt;
  
      &lt;h1&gt;{{album.album_title}}&lt;/h1&gt;
      &lt;h3&gt;{{album.artist}}&lt;/h3&gt;
  
  
  
      {% if error_message %}
          &lt;p&gt;&lt;strong&gt;{{ error_message }}&lt;/strong&gt;&lt;/p&gt;
      {% endif %}    
  
      &lt;form action="{% url 'music:favorite' album.id %}" method="post"&gt;
          {% csrf_token %}
          {% for song in album.song_set.all %}
              &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;
  {% endblock %}
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>{% extends 'music/base.html' %}
  
  {% block body %}
      {% if all_albums %}
          &lt;h3&gt;Here are all my Albums:&lt;/h3&gt;
          &lt;ul&gt;
  
  
              {% for album in all_albums %}
  
  
              &lt;li&gt;&lt;a href="{% url 'music:details' album.id %}"&gt;{{ album.album_title }}&lt;/a&gt;&lt;/li&gt;
  
              {% endfor %}
          &lt;/ul&gt;
      {% else %}
          &lt;h3&gt;You don't have any albums&lt;/h3&gt;
      {% endif %}         
  {% endblock %}
  </code></pre>
  
  <p>base.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;Viberr&lt;/title&gt;
      {% load staticfiles %} 
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"  /&gt;
      &lt;link href='https://fonts.googleapis.com/css?family=Satisfy' rel='stylesheet' type="text/css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="{% static 'music/style.css' %}" /&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;nav class="navbar navbar-inverse"&gt;
                  &lt;div class="container-fluid"&gt;
  
                      &lt;!-- Header --&gt;
                      &lt;div class="navbar-header"&gt;
                          &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#topNavBar"&gt;
                              &lt;span class="icon-bar"&gt;&lt;/span&gt;
                              &lt;span class="icon-bar"&gt;&lt;/span&gt;
                              &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;/button&gt;
                          &lt;a class="navbar-brand" href="{% url 'music:index' %}"&gt;University of Calicut&lt;/a&gt;
                      &lt;/div&gt;
  
                      &lt;!-- Items --&gt;
                      &lt;div class="collaps navbar-collaps" id="topNavBar"&gt;
                          &lt;ul class="nav navbar-nav"&gt;
                              &lt;li class="active"&gt;
                                  &lt;a href="{% url 'music:index' %}"&gt;
                                      &lt;span class="glyphicon glyphicon-cd" aria-hidden="true"&gt;&lt;/span&gt;&amp;nbsp;
                                      Albums
                                  &lt;/a&gt;
                              &lt;/li&gt;
                              &lt;li class=""&gt;
                                      &lt;a href="{% url 'music:index' %}"&gt;
                                          &lt;span class="glyphicon glyphicon-music" aria-hidden="true"&gt;&lt;/span&gt;&amp;nbsp;
                                          Songs
                                      &lt;/a&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
  
                          &lt;form class="navbar-form navbar-left" role="search" method="GET" action="#"&gt;
                              &lt;div&gt;
                                  &lt;input type="text" class="form-control" name="q" value=""&gt;
                                  &lt;button type="submit" class="btn btn-default"&gt;Search&lt;/button&gt;
                              &lt;/div&gt;
  
                          &lt;/form&gt;
  
                          &lt;ul class="nav navbar-nav navbar-right"&gt;
                              &lt;li class=""&gt;
                                  &lt;a href="#"&gt;
                                      &lt;span class="glyphicon glyphicon-plus" aria-hidden="true"&gt;&lt;/span&gt;&amp;nbsp;
                                      Add Album
                                  &lt;/a&gt;
                              &lt;/li&gt;
  
                              &lt;li class=""&gt;
                                      &lt;a href="#"&gt;
                                          &lt;span class="glyphicon glyphicon-off" aria-hidden="true"&gt;&lt;/span&gt;&amp;nbsp;
                                          Logout
                                      &lt;/a&gt;
                              &lt;/li&gt;
  
                          &lt;/ul&gt;
  
  
                      &lt;/div&gt;
  
  
                  &lt;/div&gt;
      &lt;/nav&gt;
  {% block body %}
  
  {% endblock %}
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>urls.py (music)</p>
  
  <pre><code>from django.conf.urls import url
  from .import views
  from django.urls import path
  
  
  app_name = 'music'
  
  urlpatterns = [
  
  
      url(r'^$',views.IndexView.as_view(), name='index'),
  
      url(r'^(?P&lt;pk&gt;[0-9]+)/$',views.DetailView.as_view(), name='details'),
  
  ]
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>from django.db import models
  
  
  
  class Album(models.Model):
      artist = models.CharField(max_length=250)
      album_title=models.CharField(max_length=500)
      genre=models.CharField(max_length=100)
      album_logo=models.CharField(max_length=1000)
  
  
      def __str__(self):
          return self.album_title + ' - ' + self.artist
  
  class Song(models.Model):
      album = models.ForeignKey(Album, on_delete=models.CASCADE)
      file_type = models.CharField(max_length=10)
      song_title = models.CharField(max_length=250) 
      is_favorite = models.BooleanField(default=False)
  
  
      def __str__(self):
          return self.song_title
  </code></pre>
  
  <ol>
  <li><img src="https://i.stack.imgur.com/lapiy.png" alt=""></li>
  <li><p><img src="https://i.stack.imgur.com/Ctas0.png" alt=""> </p>
  
  <p>I attached images of my home page and linked page,
  please help me regarding the issue</p></li>
  </ol>
  
  <p>n the above code, the second page is throwing me a error</p>
  
  <blockquote>
    <p>django.urls.exceptions.NoReverseMatch: Reverse for 'favorite' not found. 'favorite' is not a valid view function or pattern name**</p>
  </blockquote>
  
  <p>Please someone help me out where im wrong! Thanks in advance!</p>