title: Reverse for 'add_review' with arguments '('',)' not found. 1 pattern(s) tried: ['addreview/(?P<id>[0-9]+)/$']
body: <p>I am getting an error after i have added Review model in django... on admin page model is created but on my site it is not working.I don't know where i am going wrong ...please guide me</p>
  <blockquote>
  <p>Getting an error on line 28 of base.html</p>
  <p>Its also showing an error on views.py line 21</p>
  </blockquote>
  <p><strong>views.py</strong></p>
  <pre><code>from django.shortcuts import render, redirect
  from django.http import HttpResponse
  from .models import *
  from .forms import *
  
  # Create your views here.
  def home(request):
     allbooks= book.objects.all()
     context= {
        &quot;books&quot;: allbooks,
        }
     return render(request,'main/index.html',context) #error line
  
  def detail (request,id):
     bk=book.objects.filter(id=id)
     reviews=Review.objects.filter(book=id)   
     context ={
        &quot;book&quot;:bk,
        &quot;reviews&quot;:reviews
        }
     return render (request,'main/details.html',context)
  
  def addBooks(request):
     if request.user.is_authenticated:
        if request.user.is_superuser:
           if request.method== &quot;POST&quot;:
              form=BookForm (request.POST or None)
  
              if form.is_valid():
                 data=form.save(commit=False)
                 data.save()
                 return redirect(&quot;main:home&quot;)
           else:
              form=BookForm()
           return render (request, 'main/addbooks.html',{&quot;form&quot;:form,&quot;controller&quot;:&quot;Add Books&quot;})
        else:
           return redirect(&quot;main:home&quot;)
     else:
        return redirect(&quot;accounts:login&quot;)
  
  
  def editBooks(request,id):
     if request.user.is_authenticated:
        if request.user.is_superuser:
           bk=book.objects.get(id=id)
           if request.method== &quot;POST&quot;:
              form=BookForm (request.POST or None,instance=bk)
  
              if form.is_valid():
                 data=form.save(commit=False)
                 data.save()
                 return redirect(&quot;main:detail&quot;,id)
           else:
              form=BookForm(instance=bk)
           return render (request, 'main/addbooks.html',{&quot;form&quot;:form,&quot;controller&quot;:&quot;Edit Books&quot;})
        else:
           return redirect(&quot;main:home&quot;)
     else:
        return redirect(&quot;accounts:login&quot;)
  
  def deleteBooks(request,id):
     if request.user.is_authenticated:
        if request.user.is_superuser:
           bk=book.objects.get(id=id)
           bk.delete()
           return redirect(&quot;main:home&quot;) 
        else:
           return redirect(&quot;main:home&quot;)
     else:
        return redirect(&quot;accounts:login&quot;)
  
  
  def add_review(request,id):
     if request.user.is_authenticated:
        bk=book.objects.get(id=id)
        if request.method == &quot;POST&quot;:
           form= ReviewForm(request.POST or None)
           if form.is_valid():
              data=form.save(commit=False)
              data.comment=request.POST[&quot;comment&quot;]
              data.rating=request.POST[&quot;rating&quot;]
              data.user=request.user
              data.book=bk
              data.save()
              return redirect(&quot;main:detail&quot;,id)
        else:
           form=ReviewForm()
        return render(request,'main/details.html',{&quot;form&quot;:form}) 
     else:
        return redirect(&quot;accounts:login&quot;)
  </code></pre>
  <p><strong>base.html</strong></p>
  <pre><code>&lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;
      &lt;ul class=&quot;navbar-nav mr-auto&quot;&gt;
        &lt;li class=&quot;nav-item active&quot;&gt;
          &lt;a class=&quot;nav-link&quot; href=&quot;{%url 'main:home'%}&quot;&gt;Home&lt;span class=&quot;sr-only&quot;&gt;(current)&lt;/span&gt;&lt;/a&gt; &lt;!--error line--&gt;
        &lt;/li&gt;
        {% if request.user.is_authenticated %}
        {% if request.user.is_superuser %}
        &lt;li class=&quot;nav-item&quot;&gt;
          &lt;a class=&quot;nav-link&quot; href=&quot;{% url 'main:add_books'%}&quot;&gt;Add Books&lt;/a&gt;
        &lt;/li&gt;
         {% endif %}
         {% endif %}
  </code></pre>
  <p><strong>details.html</strong></p>
  <pre><code> &lt;div class=&quot;card&quot;&gt;
          &lt;div class=&quot;card-body&quot;&gt;
          &lt;h3 class=&quot;text-center&quot;&gt;Reviews&lt;/h3&gt;
          &lt;form action=&quot;{%url 'main:add_review' book.id%}&quot;method=&quot;POST&quot;&gt;
          {% csrf_token %}
          &lt;label for=&quot;comment&quot;&gt;Review&lt;/label&gt;
          &lt;textarea name=&quot;comment&quot; id=&quot;comment&quot; cols=&quot;30&quot; rows=&quot;5&quot; class=&quot;form-control&quot;&gt;&lt;/textarea&gt;
  
          &lt;label for=&quot;rating&quot;&gt;Rating&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;rating&quot; class=&quot;form-control&quot;&gt;
          &lt;br&gt;
          &lt;input type=&quot;submit&quot; class=&quot;btn btn-danger&quot; value=&quot;Add Review&quot;&gt;
          &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
       &lt;div class=&quot;card&quot;&gt;
          &lt;div class=&quot;card-body&quot;&gt;
          &lt;ul&gt;
          {% for review in reviews  %}
              &lt;li&gt;{{review.comment}} &lt;i&gt;{{review.user}}&lt;/i&gt;&lt;/li&gt;
          {% endfor %}
          &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  <p><strong>models.py</strong></p>
  <pre><code>class Review(models.Model):
      book=models.ForeignKey(book,on_delete=models.CASCADE)
      user=models.ForeignKey(User,on_delete=models.CASCADE)
      comment=models.TextField(max_length=10000)
      rating=models.FloatField(default=0)
  
      def __str__(self):
          return self.user.username 
  </code></pre>