Fix bug with tag slugs

master
Nick Sergeant 2012-03-10 21:52:46 -05:00
parent 7c8de00658
commit a5cc98d507
3 changed files with 8 additions and 6 deletions

View File

@ -3,7 +3,7 @@
{% block breadcrumb %}
<li><a href="/public/">public</a></li>
{% if tag %}
<li>/ <a href="/public/tag/{{ tag }}/">{{ tag }}</a></li>
<li>/ <a href="/public/tag/{{ tag.slug }}/">{{ tag.name }}</a></li>
{% endif %}
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block breadcrumb %}
<li><a href="/{{ user.username }}/">{{ user.username }}</a></li>
{% if tag %}
<li>/ <a href="/{{ user.username }}/tag/{{ tag }}/">{{ tag }}</a></li>
<li>/ <a href="/{{ user.username }}/tag/{{ tag.slug }}/">{{ tag.name }}</a></li>
{% endif %}
{% endblock %}

View File

@ -24,14 +24,15 @@ def list_public(request, tag_slug=None):
snipts = Snipt.objects.filter(public=True).order_by('-created')
if tag_slug:
snipts = snipts.filter(tags__name__in=[tag_slug])
snipts = snipts.filter(tags__slug__in=[tag_slug])
tag = get_object_or_404(Tag, slug=tag_slug)
return {
'has_snipts': True,
'public': True,
'snipts': snipts,
'tags': tags,
'tag': tag_slug,
'tag': tag,
}
@render_to('snipts/list-user.html')
@ -58,14 +59,15 @@ def list_user(request, username, tag_slug=None):
snipts = snipts.order_by('-created')
if tag_slug:
snipts = snipts.filter(tags__name__in=[tag_slug])
snipts = snipts.filter(tags__slug__in=[tag_slug])
tag = get_object_or_404(Tag, slug=tag_slug)
return {
'has_snipts': True,
'public': public,
'snipts': snipts,
'tags': tags,
'tag': tag_slug,
'tag': tag,
'user': user,
}