[Answered ]-How do I turn my urls into readable names?

2👍

✅

Your urls.py should be,

url(r'^(?P<category_name>\w+)/$', 'stories.views.category'),

while, the views.py should be something like,

def category(request, category_name):
    template = 'stories/category.html'
    category = Category.objects.get(category_name = category_name)
    return render_to_response(template, {
        'category': category
        })

the above, might work if you are not using slugified category_name. If you do, then use a slug field in your model as mentioned by this stack overflow answer

Leave a comment