title: What is the solution to "django.urls.exceptions.NoReverseMatch" error when creating a Django model object?
body: <p>I am trying to create an application conference for which code files are below.
  I am running into an error as can be seen from attached file when I click create conference button in conference_list.html file. </p>
  
  <p>Error shown in Console:</p>
  
  <p><a href="https://i.stack.imgur.com/Xccwy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xccwy.png" alt="enter image description here"></a></p>
  
  <p>I have included static files in base.html and extended in all other app_name_base.html files. </p>
  
  <hr>
  
  <p>Culprit line as pointed by chrome browser is in file views.py of conferences app as follows:</p>
  
  <h2>return render(request , 'conferences/conference_create.html')</h2>
  
  <p>Please help. Files are shown below:</p>
  
  <h2>conferences models.py</h2>
  
  <pre><code>from django.db import models
  from django.utils.text import slugify
  from django.urls import reverse
  
  import misaka
  
  from datetime import date
  import datetime
  from django.contrib.auth import get_user_model
  User = get_user_model()
  from django import template
  register = template.Library()
  
  class Conference(models.Model):
      name = models.CharField(max_length=255,unique=True)
      poster = models.ImageField(upload_to='images/%Y/%m/%d',blank=True)
      venue = models.CharField(max_length=255,editable=True,default='Online')
      created_at = models.DateTimeField(auto_now_add=True,blank=False)
      conference_on = models.DateTimeField(auto_now_add=True,blank=False)
      registration_till = models.DateField(auto_now_add=False, blank=True)
      audience = models.TextField(blank=True,default='Add your audience type here i.e. "Below 25","Entrepreneurs","Music"')
      description = models.TextField(blank=True,default='Add your event description here i.e. "Coding Event for python developers"')
      slug = models.SlugField(allow_unicode=True, unique=True)
      audience_html = models.TextField(editable=False,default='',blank=True)
      conference_user = models.ForeignKey(User, related_name='User', null=True,on_delete=models.CASCADE)
      members = models.ManyToManyField(User,through="ConferenceMember")
      # Add a company user here
  
  
      def __str__(self):
          return self.name
  
      def save(self,*args,**kwargs):
          self.slug = slugify(self.name)
          self.audience_html = misaka.html(self.audience)
          super().save(*args,**kwargs)
  
      def get_absolute_url(self):
          return reverse('conferences:single',kwargs={"slug": self.slug})
  
      class Meta:
          ordering = ['name']
      def daysleft(self):
          if datetime.date.today() &gt; self.conference_on.date():
              return False
          else:
              return self.conference_on.date() - datetime.date.today()
      def registration(self):
          if datetime.date.today()  &gt; self.registration_till:
              return False
          else:
              return self.registration_till - datetime.date.today()
  
      def summary(self):
          return self.description[:100]
      def reg_date_pretty(self):
          return self.registration_till.strftime('%b %e %Y')
      def conf_date_pretty(self):
          return self.conference_on.strftime('%b %e %Y')
  
  
  
  
  
  
  class ConferenceMember(models.Model):
      conference = models.ForeignKey(Conference,related_name="memberships",on_delete=models.CASCADE)
      user = models.ForeignKey(User,related_name="user_groups",on_delete=models.CASCADE)
  
      def __str__(self):
          return self.user.username
      class Meta:
          unique_together = ('conference','user')
  
  
  
      pass
  </code></pre>
  
  <h2>conferences application "create" function in views.py</h2>
  
  <pre><code>@login_required(login_url = "accounts/signup")
  def create(request):
      if request.method == 'POST':
          if request.POST['name'] and request.POST['venue'] and request.POST['registration_till'] and request.FILES['poster']  and request.POST['audience']:
              project = Conference()
              project.name = request.POST['name']
              project.venue = request.POST['venue']
              project.registration_till = request.POST['registration_till']
              project.poster = request.cleaned_data['poster']
  
              project.audience = request.POST['audience']
              project.created_at = timezone.datetime.now()
              project.conference_user = request.user
              project.save()
              return redirect('conferences/event/in/' + str(project.slug))
          else:
              return render(request , 'conferences/conference_create.html',{'error':'All fields are required.'})
      else:
          return render(request , 'conferences/conference_create.html')
  </code></pre>
  
  <h2>conferences urls.py</h2>
  
  <pre><code>from django.urls import path
  from . import views
  app_name="conferences"
  urlpatterns=[
      path('',views.ListConferences.as_view(),name='all'),
      # path('event/in/&lt;int:conference_id&gt;',views.SingleConference,name='single'),
      path('event/in/&lt;slug:slug&gt;',views.SingleConference.as_view(),name='single'),
      path('create', views.create , name = 'create'),
      path('join/&lt;slug:slug&gt;',views.JoinConference.as_view(),name="join"),
      path('leave/&lt;slug:slug&gt;',views.LeaveConference.as_view(),name="leave"),
  ]
  </code></pre>
  
  <h2>conferences conference_list.html</h2>
  
  <pre><code>{% extends "conferences/conference_base.html" %}
  {% block pregroup %}
  
  &lt;div class="row"&gt;
    &lt;div class="col-md-4"&gt;
      &lt;div class="content profile"&gt;
        {% if user.is_authenticated %}
  
          &lt;h2&gt;Welcome Back
            &lt;a href="{% url 'posts:for_user' username=user.username %}"&gt;@{{user.username}}&lt;/a&gt;
          &lt;/h2&gt;
  
        {% endif %}
  
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  {% endblock %}
  
  {% block group_content %}
  &lt;a href="{% url 'conferences:create' %}" class="nav-item nav-link btn btn-info btn-lg plus"&gt;
    Create Conference
  &lt;/a&gt;
  {% for conference in object_list %}
  &lt;div class="row"&gt;
    &lt;div class="col-md-2"&gt;
      &lt;img src="{{conference.poster.url}}" alt="Image" width=200 height=150&gt;
    &lt;/div&gt;
    &lt;div class="col-md-10"&gt;
      &lt;div class="list-group"&gt;
  
  
  
        &lt;a href="{% url 'conferences:single' slug=conference.slug %}" class="list-group-item"&gt;
          &lt;h3 class="title list-group-item-heading"&gt;{{conference.name}}&lt;/h3&gt;
          &lt;div class="list-group-item-text container-fluid"&gt;
            {{conference.audience_html|safe}}
            &lt;div class="row"&gt;
              &lt;div class="col-md-4"&gt;
                &lt;span class="badge"&gt;{{ conference.members.count }}&lt;/span&gt; attendy{{ conference.members.count|pluralize }}
                &lt;span class="badge"&gt;
                  {% if conference.registration %}
                      Hurray conference is in {{conference.daysleft}} days. Registration closes in {{conference.registration}}
                  {% else %}
                      Conference was on {{conference.conference_on}}. Visit Post Section on {{conference.name}} Page.
                  {% endif %}
                &lt;/span&gt;
  
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/a&gt;
        &lt;br&gt;
  
  
  
      &lt;/div&gt;
  
    &lt;/div&gt;
  
  &lt;/div&gt;
  
  {% endfor %}
  {% endblock %}
  </code></pre>
  
  <h2>conference_create.html</h2>
  
  <pre><code>{% extends 'base.html' %}
  {% block content %}
  {% if error %}
  &lt;p class="alert alert-primary" role="alert"&gt;{{error}}&lt;/p&gt;
  &lt;br&gt;
  &lt;br&gt;
  {% endif %}
  &lt;h1&gt;Create your hosted Conference&lt;/h1&gt;
  &lt;form action="{% url 'conferences:create' %}" method = "POST" enctype = "multipart/form-data"&gt;
  
      {% csrf_token %}
      Name:&lt;br/&gt;
      &lt;input style="background-color:white;
                border: solid 1px #6E6E6E;
                height: 30px;
                font-size:18px;
                vertical-align:9px;color:#bbb" type="text" name = "name" /&gt;
      &lt;br/&gt;
      Venue:&lt;br/&gt;
      &lt;input style="background-color:white;
                border: solid 1px #6E6E6E;
                height: 30px;
                font-size:18px;
                vertical-align:9px;color:#bbb" type="textbox" name = "venue" /&gt;
      &lt;br/&gt;
      Audience:&lt;br/&gt;
      &lt;input style="background-color:white;
                border: solid 1px #6E6E6E;
                height: 30px;
                font-size:18px;
                vertical-align:9px;color:#bbb" type="textbox" name = "audience" /&gt;
      &lt;br/&gt;
  
      &lt;!-- Registration open till:&lt;br/&gt;
      &lt;input type="date" name = "reg_date" /&gt;
      &lt;br/&gt;
      Conference on Date:&lt;br/&gt;
      &lt;input type="date" name = "conf_date" /&gt;
      &lt;br/&gt; --&gt;
      Poster:&lt;br/&gt;
      &lt;input type="file" name = "poster" /&gt;
      &lt;br/&gt;
      &lt;input type="submit" value = "Create Conference" class = "btn btn-primary"/&gt;
  &lt;/form&gt;
  
  
  {%endblock%}
  </code></pre>
  
  <h2>Project urls.py</h2>
  
  <pre><code>from django.conf.urls.static import static
  from django.contrib import admin
  from django.conf import settings
  from django.urls import path, include
  from . import views
  urlpatterns = [
      path('admin/', admin.site.urls),
      path('',views.HomePage.as_view(),name = "home"),
      path('accounts/',include('accounts.urls',namespace="accounts")),
      path('accounts/', include("django.contrib.auth.urls")),
      path('thanks/',views.ThanksPage.as_view(),name="thanks"),
      path('conferences/',include('conferences.urls',namespace="conferences")),
      path('companies/',include('companies.urls',namespace="companies")),
      path('posts/',include('posts.urls',namespace="posts")),
      path('profiles/',include('profiles.urls',namespace="profile")),
  
  ]
  from django.contrib.staticfiles.urls import staticfiles_urlpatterns
  urlpatterns += staticfiles_urlpatterns()
  urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  </code></pre>
  
  <p>Edit and Solution:
  I have also added modified conference_create.html file [Culprit line was line 9 as i needed to add <code>action="{% url 'conferences:create' %}"</code> in html form.</p>