title: Django: URL pattern to include values from multiple fields
body: <p>I'm fairly new to python and I'm trying to build a URL pattern that takes two fields as parameters. This is part of my model:</p>
  
  <pre><code>CATEGORY_CHOICES = (
      ('M', 'Music'),
      ('G', 'Games'),
      ('T', 'TV'),
      ('F', 'Film'),
      ('O', 'Misc'),
  )
  category = models.CharField(max_length = 1, choices = CATEGORY_CHOICES)
  slug = models.SlugField(unique=True, max_length=255)
  </code></pre>
  
  <p>What I want to achieve is to be able to call a such as: thisblog.com/music/this-post where /music is the category and /this-post is the slug.</p>
  
  <p>I had an attempt but I can't figure out how to do it properly:</p>
  
  <pre><code>urlpatterns = patterns('',
  
  url(r'^admin/', include(admin.site.urls)),
  url(r'^$', 'blog.views.index'),
  url(r'^(?P&lt;category&gt;[\w\-]+)/(?P&lt;slug&gt;[\w\-]+)/$', blog_post, name = 'blog_post'),
  </code></pre>
  
  <p>)</p>
  
  <p>This gives me a 'NoReverseMatch at /' error.</p>
  
  <p>Any help is greatly appreciated :)</p>
  
  <p>UPDATE:</p>
  
  <p>In my html template I have a link:</p>
  
  <pre><code>&lt;p&gt;&lt;a class="btn btn-default" href="{{post.get_absolute_url}}" role="button"&gt;Read more &amp;raquo;&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>get_absolute_url is defined as:</p>
  
  <pre><code>    def get_absolute_url(self):
          return reverse ('blog.views.post', args = [self.slug])
  </code></pre>