Saturday, June 5, 2010

searching by slug not working in cases with spaces (that really rolls off the tongue)

I am trying to capture the slug from a URL to search and find the
object with that slug. Here is my URLconf:

(r'^brewery/(\w+)', breweryDetail),

It works when there are no spaces in the slug, but nothing comes up
when there are. There are no errors just no results showing up.
Here is my view code:

def breweryDetail(request, brewerySlug):
brews = Brew.objects.filter(brewerySlug__exact=brewerySlug)
return render_to_response('brewery_detail.html', {'brews': brews})

Anyone have any ideas?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate