title: Django: NoReverseMatch at /shop/stickers/minion-cushion/medida-y-cantidad
body: <p>I've problems when trying to access to the 2nd part of a 2 Steps form. </p>
  
  <p>When clicking on a product, in a given category, for example category 'stickers' and product 'minion-cushion', users are taken to this url:</p>
  
  <pre><code>/shop/stickers/minion-cushion/medida-y-cantidad
  </code></pre>
  
  <p>In here they'll find a form 'StepOneForm' that only displays a tamanios (sizes in english) and cantidades (quantities in english) both as forms.ChoiceFields. </p>
  
  <p>I'll capture the user's choices for this fields and save the values in the <code>session</code>. And then user should click on <code>Continuar</code> button and should be taken to this url:</p>
  
  <pre><code>/shop/stickers/minion-cushion/subir-arte
  </code></pre>
  
  <p>Where users will see the 2nd form "StepTwoForm" and the button to submit the form to DataBase.</p>
  
  <p>However, when using this in my StepOneForm template, I get this error:</p>
  
  <pre><code>&lt;a  href="{% url 'shop:UploadArt' %}" class="btn btn-naranja text-white btn-block"&gt;Continuar&lt;/a&gt;
  </code></pre>
  
  <p><strong>Error</strong>:</p>
  
  <pre><code>NoReverseMatch at /shop/stickers/minion-cushion/medida-y-cantidad
  Reverse for 'UploadArt' with no arguments not found. 1 pattern(s) tried: ['shop\\/(?P&lt;c_slug&gt;[-a-zA-Z0-9_]+)\\/(?P&lt;product_slug&gt;[-a-zA-Z0-9_]+)\\/subir\\-arte$']
  </code></pre>
  
  <p>But leaving the a tag href attribute blank lets me access this page without problems (except, obviously, I cannot access the the next page when clicking on Continue).</p>
  
  <pre><code>&lt;a  href="" class="btn btn-naranja text-white btn-block"&gt;Continuar&lt;/a&gt;
  </code></pre>
  
  <p>Likes this: </p>
  
  <p><a href="https://i.stack.imgur.com/XIB7F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XIB7F.png" alt="enter image description here"></a></p>
  
  <p><strong>Form in template</strong>:</p>
  
  <pre><code>&lt;form method="post"&gt;
      {% csrf_token %}
  
  
      &lt;div id="tamanios"&gt;
  
      &lt;legend class="text-size20 bold-font"&gt; {{ form.tamanios.label }}&lt;/legend&gt;
  
  
      &lt;ul class="form-items"&gt;
         &lt;li&gt;
              &lt;span&gt;
                  {{ form.tamanios.0.tag }}
                  {{ form.tamanios.0.choice_label }}
              &lt;/span&gt;
         &lt;/li&gt;                              
       &lt;/ul&gt;
  
      &lt;/div&gt;
  
  
      &lt;a  href="{% url 'shop:UploadArt' %}" class="btn btn-naranja text-white btn-block"&gt; Continuar &lt;/a&gt;
      &lt;/br&gt;
      &lt;p&gt;Siguiente: subir imagen&lt;/p&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>My urls</strong>: </p>
  
  <pre><code>app_name = 'shop'
  
  urlpatterns = [
  
      path('', views.allProdCat, name = 'allProdCat'),
      path('&lt;slug:c_slug&gt;', views.allProdCat, name = 'products_by_category'),
      path('&lt;slug:c_slug&gt;/&lt;slug:product_slug&gt;/medida-y-cantidad', views.StepOneView.as_view(), name='ProdCatDetail'),
      path('&lt;slug:c_slug&gt;/&lt;slug:product_slug&gt;/subir-arte', views.StepTwoView.as_view(), name='UploadArt'),
  
  ]
  </code></pre>
  
  <p><strong>shop/views.py</strong></p>
  
  <pre><code>class StepOneView(FormView):
      form_class = StepOneForm
      template_name = 'shop/product.html'
      success_url = 'shop/subir-arte'
  
      def get_initials(self):
           # pre-populate form if someone goes back and forth between forms
           initial = super(StepOneView, self).get_initial()
           initial['tamanios'] = self.request.session.get('tamanios', None)
           initial['cantidades'] = self.request.session.get('cantidades', None)
           return initial
  
           # pre-populate form if someone goes back and forth between forms
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['product'] = Product.objects.get(
              category__slug=self.kwargs['c_slug'],
              slug=self.kwargs['product_slug']
          )
          return context
  
  
      def form_valid(self, form):
          # In form_valid method we can access the form data in dict format
          # and will store it in django session
          self.request.session['tamanios'] = form.cleaned_data.get('tamanios')
          self.request.session['cantidades'] = form.cleaned_data.get('cantidades')
          return HttpResponseRedirect(self.get_success_url())
  
  
  # here we are going to use CreateView to save the Third step ModelForm
  class StepTwoView(CreateView):
      form_class = StepTwoForm
      template_name = 'shop/subir-arte.html'
      success_url = '/'
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['product'] = Product.objects.get(
              category__slug=self.kwargs['c_slug'],
              slug=self.kwargs['product_slug']
          )
          return context
  
      def form_valid(self, form):
          form.instance.tamanios = self.request.session.get('tamanios')  # get tamanios from session
          form.instance.cantidades = self.request.session.get('cantidades')  # get cantidades from session
          del self.request.session['cantidades']  # delete cantidades value from session
          del self.request.session['tamanios']  # delete tamanios value from session
          self.request.session.modified = True
          return super(StepTwoView, self).form_valid(form)
  </code></pre>
  
  <p><strong>shop/models.py</strong></p>
  
  <pre><code>class Category(models.Model):
      name = models.CharField(max_length=250, unique=True)
      slug = models.SlugField(max_length=250, unique=True)
      description = models.TextField(blank=True)
      image = models.ImageField(upload_to='category', blank=True)
  
      class Meta:
          ordering = ('name',)
          verbose_name = 'category'
          verbose_name_plural = 'categories'
  
      def get_url(self):
          return reverse('shop:products_by_category', args=[self.slug])
  
      def __str__(self):
          return '{}'.format(self.name)
  
  
  class Product(models.Model):
      name = models.CharField(max_length=250, unique=True)
      slug = models.SlugField(max_length=250, unique=True)
      description = models.TextField(blank=True)
      category = models.ForeignKey(Category, on_delete=models.CASCADE)
      price = models.DecimalField(max_digits=10, decimal_places=2)
      image = models.ImageField(upload_to='product', blank=True)
      stock = models.IntegerField()
      available = models.BooleanField(default=True)
      created = models.DateTimeField(auto_now_add=True)
      updated = models.DateTimeField(auto_now=True)
  
      class Meta:
          ordering = ('name',)
          verbose_name = 'product'
          verbose_name_plural = 'products'
  
      def get_url(self):
          return reverse('shop:ProdCatDetail', args=[self.category.slug, self.slug])
  
      def __str__(self):
          return '{}'.format(self.name)
  
  
  class TamaniosCantidades(models.Model):
  
      # usuario = models.ForeignKey(User, on_delete=models.DO_NOTHING)
      producto = models.ForeignKey(Product, on_delete=models.CASCADE)
      tamanios = models.CharField(max_length=10, choices=TAMANIOS)
      cantidades = models.CharField(max_length=10, choices=CANTIDADES)
      imagenes = models.FileField(upload_to='imagenes/', null=True, blank=True)
      # imagenes = models.ImageField(upload_to='category', blank=True)
      instrucciones = models.CharField(max_length=200, blank=True, null=True, default='')
      uploaded_at = models.DateTimeField(auto_now_add=True)
  
      def __str__(self):
          return self.tamanios
  </code></pre>
  
  <p><strong>shop/forms.py</strong></p>
  
  <pre><code>class StepOneForm(forms.Form):
      tamanios = forms.ChoiceField(choices=TAMANIOS, widget=forms.RadioSelect(), label='Selecciona un tamaño')
      cantidades = forms.ChoiceField(choices=CANTIDADES, widget=forms.RadioSelect(), label='Selecciona la cantidad')
  
  
  class StepTwoForm(forms.ModelForm):
      instrucciones = forms.CharField(widget=forms.Textarea)
  
      class Meta:
          model = TamaniosCantidades
          fields = ('imagenes', 'instrucciones')
  
      def __init__(self, *args, **kwargs):
          super(StepTwoForm, self).__init__(*args, **kwargs)
          self.fields['instrucciones'].required = False
  </code></pre>