Trying to pass Business Name in URL in stead of ID. When I pass IDs, everything is fine.
urls.py
url(r'^(?P<name>\w+)/$', 'views.business'),
views.py
def business(request, name=1):
return render_to_response('business.html',
{'business': business.objects.get(name=name) })
template.html
<a href="http://website.com/{{ business.name|slugify }}/">Name{{ business.name }}</a>
When I do this, it will only work for single word business name such as "Bank" however if the business has multiple words "Wells Fargo" it will not work.
My goal is to use slugify to pass short SEO friendly URL such as
http://website.com/business-name/
Thanks for your time and for your help!