Hi everyone,
According to: http://www.djangoproject.com/documentation/url_dispatch/
I'm supposed to be able to use {% url url-name parameter(s) %}, to de-
couple models form URLs.
Here's a snippet from my template:
{% for group in groups %}
<a href="{% url show-group group.slug %}">{{ group.name }}</a>
{% endfor %}
#in urls.py
urlpatterns = patterns('',
url(r'^(?P<slug>[w-]+)/$', 'my_site.groups.views.show_group',
name='show-group')
)
#in views.py
from django.shorcuts import get_object_or_404, render_to_response
from my_site.groups.models import Group
def show_group(request, slug)
group = get_object_or_404(Group, slug=slug)
return render_to_response('group.html', {'group' : group})
But, this doesn't seem to work. I get an empty string for the value of
my href. Can someone please point out what I'm doing wrong?
TIA,
Brandon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---