Adding Category Path in Django Blog
<p>I am adding a blog to my site and so far everything has been successful. Per the code snippets below, I have a slug field that dynamically creates the url and a tag system.  I am not looking for anything super crazy since the blogs are specifically being used for search engine marketing, but I am missing one important thing that I need help with.</p>

<p>Currently when I create a new blog the path is www.mysite.com/blog/this-is-the-title-slug but what I really need to do is have the ability to create add a category from the admin dashboard that would then insert into the url like so www.mysite.com/blog/mycategory/this-is-the-title-slug.</p>

<p><strong>Here is some of my code:</strong></p>

<p><strong>My Urls:</strong></p>

<pre><code>from django.conf.urls import url
from . import views, feed

urlpatterns = [
    url(r'^$', views.BlogIndex.as_view(), name='post_list'),
    url(r'^(?P&lt;slug&gt;\S+)$', views.BlogDetail.as_view(), name="post_detail"),
    url(r'^feed/$', feed.LatestPosts(), name="feed"), name='post_edit'),
]
</code></pre>

<p><strong>My Models</strong></p>

<pre><code>from django.db import models
from django.core.urlresolvers import reverse
from django_markdown.models import MarkdownField


class EntryQuerySet(models.QuerySet):
    def published(self):
        return self.filter(publish=True)


class Tag(models.Model):
    slug = models.SlugField(max_length=200, unique=True)

    def __str__(self):
        return self.slug


class Entry(models.Model):
    title = models.CharField(max_length=200)
    body = MarkdownField()
    slug = models.SlugField(max_length=200, unique=True)
    publish = models.BooleanField(default=False)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

    objects = EntryQuerySet.as_manager()
    tags = models.ManyToManyField(Tag)

    def get_absolute_url(self):
        return reverse("post_detail", kwargs={"slug": self.slug})

    def __str__(self):
        return self.title

    class Meta:
        verbose_name = "Blog Entry"
        verbose_name_plural = "Blog Entries"
        ordering = ["-created"]
</code></pre>

<p><strong>Screenshot Pointing Out location of Category Insert</strong></p>

<p><a href="https://i.stack.imgur.com/kk3b7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kk3b7.png" alt="enter image description here"></a></p>

<p>Thank you for your help.  Happy New Year!!</p>