попробуйте это, в url.py
url(r'^(?P<link>[\w|-]+)/$', views.categoryNewsList, name='categoryNewsList')
view.py
def categoryNewsList(request, link):
categories = {
"graphics-design": "GD",
"digital-marketing": "DM",
"video-animation": "VA",
"music-audio": "MA",
"programming-tech": "PT"
}
try:
foos = Category.objects.filter(name=categories[link])
return render(request, 'yoursite/home.html', locals())
except KeyError:
return redirect('yoursite/home.html')
и в ваш template.html поместите ссылки:
<nav class="navbar navbar-expand-sm bg-light navbar-light justify-content-center">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/">All categories</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/graphics-design">Graphics & Design</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/digital-marketing">Digital Marketing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/video-animation">Video & Animation</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/music-audio">Music & Audio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/programming-tech">Programming & Tech</a>
</li>
</ul>