title: Django: Reverse for 'add_review' with arguments '('',)' not found. 1 pattern(s) tried: ['movies/addreview/(?P<id>[0-9]+)/\\Z']
body: <p>I want to add review function in <code>movie_detail.html</code>, but I don't know how to query comments and map to <code>movie_detail</code>.It returns Reverse for 'add_review' with arguments '('',)' not found error.</p>
  <p>My url.py:</p>
  <pre><code>urlpatterns = [
      path('', MovieList.as_view(), name='movie_list'),
      path('&lt;int:pk&gt;', MovieDetail.as_view(), name='movie_detail'),
      path('search/', MovieSearch.as_view(), name='movie_search'),
      path('addreview/&lt;int:id&gt;/', views.add_review, name='add_review'),
  ]
  </code></pre>
  <p>My model.py:</p>
  <pre><code>class Movie(models.Model):
      title = models.CharField(max_length=200)
      actors = models.CharField(max_length=500, null=True)
      poster_url = models.CharField(max_length=200)
      director = models.CharField(max_length=200, default='')
      score = models.FloatField()
      genres = models.CharField(max_length=200)
      language = models.CharField(max_length=200, default='English')
      durations = models.IntegerField(default=0)
      regions = models.CharField(max_length=200, default='')
      release_date = models.DateField(default=timezone.now)
      description = models.TextField(max_length=1000, default='')
      year = models.IntegerField(default=2000)
      views_count = models.IntegerField(default=0)
      created = models.DateTimeField(default=timezone.now)
  
      def __str__(self):
          return self.title
  
      def genres_as_list(self):
          genre_list = self.genres.split('/')
          return genre_list
  
      def actors_as_list(self):
          return self.actors.split('/')
  
  
  class Review(models.Model):
      movie = models.ForeignKey(Movie, on_delete=models.CASCADE)
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      comments = models.TextField(max_length=1000)
      rating = models.FloatField(default=0)
      data_added = models.DateTimeField(auto_now_add=True)
  
      def __str__(self):
          return self.user.username
  </code></pre>
  <p>my view.py:</p>
  <pre><code>class MovieDetail(DetailView):
      model = Movie
      template_name = &quot;main/movie_detail.html&quot;
  
      def get_object(self):
          object = super().get_object()
          object.views_count += 1
          object.save()
          return object
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['links'] = MovieLinks.objects.filter(movie=self.get_object())
          context['related_movies'] = Movie.objects.filter(genres__in=self.get_object().genres_as_list()).order_by(
              'created')[0:6]
          # context['reviews'] = Review.objects.filter(id=self.kwargs['pk'])
          return context
  
  
  class MovieSearch(ListView):
      model = Movie
      paginate_by = 20
      template_name = &quot;main/movie_list.html&quot;
  
      def get_queryset(self):
          query = self.request.GET.get('query')
          if query:
              object_list = self.model.objects.filter(title__icontains=query)
          else:
              object_list = self.model.objects.none()
          return object_list
  
  
  @login_required
  def add_review(request, id):
      movie = Movie.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_id = request.user.pk
              data.movie_id = movie.pk
              data.save()
              return redirect(&quot;main:movie_detail&quot;, id)
      else:
          form = ReviewForm()
  
      context = {&quot;form&quot;: form}
      return render(request, 'main/movie_detail.html', context)
  </code></pre>
  <p>my <code>movies_detail.html</code>  review part:</p>
  <pre><code>            &lt;section class=&quot;comments&quot;&gt;
                  &lt;h3&gt;Comment&lt;/h3&gt;
                      &lt;div class=&quot;card&quot;&gt;
                          &lt;div class=&quot;card-body&quot;&gt;
                              &lt;h3 class=&quot;text-center&quot;&gt;Add Review&lt;/h3&gt;
                              &lt;form method=&quot;POST&quot; action=&quot;{% url 'main:add_review' movie.id%}&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;
  </code></pre>
  <p>I want add the review function and I code the <code>add_review</code> in view.py by some tutorial.But I don't know how to fix it.</p>