Mercurial > public > sg101
changeset 492:3c48a555298d
Added a custom tag to display a link to a profile. Refactored the avatar tag to optionally display a profile link around the image. Removed the width and height attributes from the avatar image tag. I think this was causing disk hits whenever those properties were not cached. The avatar tag is now an inclusion tag.
line wrap: on
line diff
--- a/gpp/bio/templatetags/avatar_tags.py Thu Oct 20 01:00:19 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -""" -Template tags for the bio application. -""" -from django import template -from django.conf import settings -from django.core.cache import cache - -from bio.models import UserProfile - - -register = template.Library() - - -def get_img_info(profile=None): - """ - This function returns a 3-tuple: (url, width, height) for a user profile - avatar. If the profile is None or the profile doesn't contain a valid - avatar, info for the default avatar is returned. - - """ - if profile is None or profile.avatar.name == '': - return (settings.AVATAR_DEFAULT_URL, - settings.MAX_AVATAR_SIZE_PIXELS, - settings.MAX_AVATAR_SIZE_PIXELS) - else: - return (profile.avatar.url, - profile.avatar.width, - profile.avatar.height) - - -@register.simple_tag -def avatar(user, align='bottom'): - """ - Returns the HTML for a user's avatar image. - - If the user object has an attribute 'user_profile', this is assumed to be - the user's profile that has been pre-fetched. Otherwise, the cache is - consulted to retrieve the avatar info for the user. If there is a cache - miss, only then will a get_profile() call be made. - """ - # img_info is a tuple that contains info about the avatar: - # (url, width, height) - - if hasattr(user, 'user_profile'): - img_info = get_img_info(user.user_profile) - else: - # try the cache - cache_key = 'avatar_' + user.username - img_info = cache.get(cache_key) - if img_info is None: - try: - profile = user.get_profile() - except UserProfile.DoesNotExist: - profile = None - - img_info = get_img_info(profile) - cache.set(cache_key, img_info) - - alt = user.username - title = alt - - style = '' - if align == 'left': - style = 'style="float:left;margin-right:3px;"' - # other styles not supported - - img_tag = (u'<img src="%s" alt="%s" title="%s" width="%s" height="%s" ' - 'border="0" class="avatar" %s />') % ( - img_info[0], alt, title, img_info[1], img_info[2], style) - return img_tag
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/bio/templatetags/bio_tags.py Sat Oct 22 00:07:50 2011 +0000 @@ -0,0 +1,82 @@ +""" +Template tags for the bio application. +""" +from django import template +from django.conf import settings +from django.core.cache import cache + +from bio.models import UserProfile + + +register = template.Library() + + +def get_img_url(profile=None): + """ + This function returns a URL for a user profile avatar. + If the profile is None or the profile doesn't contain a valid + avatar, the URL for the default avatar is returned. + + """ + if profile is None or profile.avatar.name == '': + return settings.AVATAR_DEFAULT_URL + else: + return profile.avatar.url + + +@register.inclusion_tag('bio/avatar_tag.html') +def avatar(user, profile_link=True, align='bottom'): + """ + Returns the HTML for a user's avatar image. + + If the user object has an attribute 'user_profile', this is assumed to be + the user's profile that has been pre-fetched. Otherwise, the cache is + consulted to retrieve the avatar info for the user. If there is a cache + miss, only then will a get_profile() call be made. + """ + # img_info is a tuple that contains info about the avatar: + # (url, width, height) + + if hasattr(user, 'user_profile'): + img_url = get_img_url(user.user_profile) + else: + # try the cache + cache_key = 'avatar_' + user.username + img_url = cache.get(cache_key) + if img_url is None: + try: + profile = user.get_profile() + except UserProfile.DoesNotExist: + profile = None + + img_url = get_img_url(profile) + cache.set(cache_key, img_url) + + title = user.username + style = '' + if align == 'left': + style = 'style="float:left;margin-right:3px;"' + # other styles not supported + + return { + 'url': img_url, + 'title': title, + 'style': style, + 'username': user.username, + 'profile_link': profile_link, + } + + +@register.inclusion_tag('bio/profile_link_tag.html') +def profile_link(username, trailing_text=''): + """ + Renders a link to a given user's profile page. + Trailing text is any text that you want displayed after the final </a> tag. + Because of the way the Django template system works, a newline will + automatically be inserted after this tag is expanded. If you want a period + to follow immediately after the link, then set trailing_text to '.'. + Otherwise a space will appear between the linked text and any text that + follows the tag. + + """ + return {'username': username, 'trailing_text': trailing_text }
--- a/gpp/templates/bio/avatar.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/bio/avatar.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,11 +1,11 @@ {% extends 'bio/base.html' %} {% load url from future %} -{% load avatar_tags %} +{% load bio_tags %} {% block title %}Change My Avatar{% endblock %} {% block content %} <h2>Change My Avatar</h2> <p>This is your current avatar:</p> - <p>{% avatar user %}</p> + <p>{% avatar user 0 %}</p> <p> To change your avatar, upload a file using the form, below. You may leave the form blank to reset your avatar to the default.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/bio/avatar_tag.html Sat Oct 22 00:07:50 2011 +0000 @@ -0,0 +1,2 @@ +{% load url from future %} +{% if profile_link %}<a href="{% url 'bio-view_profile' username=username %}" title="View profile for {{ username }}">{% endif %}<img src="{{ url }}" alt="avatar" title="{{ title }}" class="avatar" {% if style %}style="{{ style }}"{% endif %} />{% if profile_link %}</a>{% endif %}
--- a/gpp/templates/bio/edit_profile.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/bio/edit_profile.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,6 +1,6 @@ {% extends 'bio/base.html' %} {% load url from future %} -{% load avatar_tags %} +{% load bio_tags %} {% load elsewhere_tags %} {% block title %}Edit Profile{% endblock %} {% block custom_js %} @@ -15,7 +15,7 @@ <td> <a href="{% url 'bio-change_avatar' %}"><img src="{{ STATIC_URL }}icons/image_edit.png" alt="Change Avatar" /></a> <a href="{% url 'bio-change_avatar' %}">Change Avatar</a></td> - <td>{% avatar user %}</td> + <td>{% avatar user 0 %}</td> </tr> {{ user_form.as_table }} {{ profile_form.as_table }}
--- a/gpp/templates/bio/members.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/bio/members.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,6 +1,6 @@ {% extends 'bio/base.html' %} {% load url from future %} -{% load avatar_tags %} +{% load bio_tags %} {% block title %}Member List{% endblock %} {% block bio_css %} <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/tab-nav.css" /> @@ -34,8 +34,8 @@ </tr> {% for u in page.object_list %} <tr class="{% cycle 'even' 'odd' %}"> - <td><a href="{% url 'bio-view_profile' username=u.username %}">{% avatar u %}</a></td> - <td><a href="{% url 'bio-view_profile' username=u.username %}" title="View profile for {{ u.username }}">{{ u.username }}</a></td> + <td>{% avatar u %}</td> + <td>{% profile_link u.username %}</td> <td>{{ u.get_full_name }}</td> <td>{{ u.user_profile.location }}</td> <td>{{ u.date_joined|date:"M. d, Y" }}</td>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/templates/bio/profile_link_tag.html Sat Oct 22 00:07:50 2011 +0000 @@ -0,0 +1,2 @@ +{% load url from future %} +<a href="{% url 'bio-view_profile' username=username %}" title="View profile for {{ username }}">{{ username }}</a>{{ trailing_text }}
--- a/gpp/templates/bio/view_profile.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/bio/view_profile.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,6 +1,6 @@ {% extends 'bio/base.html' %} {% load url from future %} -{% load avatar_tags %} +{% load bio_tags %} {% load elsewhere_tags %} {% load core_tags %} {% load forum_tags %} @@ -24,7 +24,7 @@ </ul> {% endif %} {% if this_is_me %} - <p>{% avatar subject %} + <p>{% avatar subject 0 %} <ul> <li><a href="{% url 'forums-my_posts' %}">My forum posts</a></li> <li><a href="{% url 'forums-manage_favorites' %}">My favorite forum topics</a></li> @@ -32,7 +32,7 @@ </ul> </p> {% else %} - <p>{% avatar subject %}</p> + <p>{% avatar subject 0 %}</p> {% endif %} <table id="bio_profile"> <tr><th>Full Name</th><td>{{ subject.get_full_name }}</td></tr>
--- a/gpp/templates/comments/comment.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/comments/comment.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,9 +1,9 @@ {% load url from future %} -{% load avatar_tags %} +{% load bio_tags %} <div class="comment" id="c{{ comment.id }}"> <div class="comment-list">{{ forloop.counter }}.</div> <div class="comment-avatar"> -<a href="{% url 'bio-view_profile' username=comment.user.username%}">{% avatar comment.user %}</a> +{% avatar comment.user %} </div> {% if comment.is_removed %} <div class="comment-text-removed"><p><em>This comment has been removed.</em></p></div> @@ -11,8 +11,7 @@ <div class="comment-text">{{ comment.html|safe }}</div> {% endif %} <div class="comment-details"> -<a href="{% url 'bio-view_profile' username=comment.user.username%}" - title="View profile for {{ comment.user.username }}">{{ comment.user.username }}</a> | +{% profile_link comment.user.username %} | {{ comment.creation_date|date:"d-M-Y H:i:s" }} {% if not comment.is_removed %} | <a href="#" class="comment-flag" id="fc-{{ comment.id }}"
--- a/gpp/templates/core/birthday_block.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/core/birthday_block.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,6 @@ {% extends 'side_block.html' %} {% load url from future %} +{% load bio_tags %} {% load humanize %} {% block block_title %}<img src="{{ STATIC_URL }}icons/cake.png" alt="Cake" class="middle" /> {{ today|date:"F" }} Birthdays <img src="{{ STATIC_URL }}icons/cake.png" alt="Cake" class="middle" /> {% endblock %} {% block block_content %} @@ -10,7 +11,7 @@ {% if bday.day == today.day %}<strong>{% endif %} {{ bday.day|ordinal }} – {% for profile in bday.profiles %} - <a href="{% url 'bio-view_profile' username=profile.user.username %}">{{ profile.user.username }}</a>{% if not forloop.last %}, {% endif %} + {% profile_link profile.user.username %}{% if not forloop.last %}, {% endif %} {% endfor %} {% if bday.day == today.day %}</strong>{% endif %} </li>
--- a/gpp/templates/core/whos_online_tag.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/core/whos_online_tag.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,11 +1,12 @@ {% load url from future %} +{% load bio_tags %} <div id="whos-online"> There {{ total|pluralize:"is,are"}} {{ total }} user{{ total|pluralize }} online: {{ num_users }} registered user{{ num_users|pluralize }} and {{ num_guests }} guest{{ num_guests|pluralize }}. {% if num_users %} Registered users: <ul class="inline-list"> {% for user in users %} -<li><a href="{% url 'bio-view_profile' username=user %}">{{ user }}</a></li> +<li>{% profile_link user %}</li> {% endfor %} </ul> {% endif %}
--- a/gpp/templates/donations/index.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/donations/index.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% block title %}Donations{% endblock %} {% block content %} <h2>Donations</h2> @@ -34,7 +35,7 @@ {{ anonymous }} {% else %} {% if donation.user %} - <a href="{% url 'bio-view_profile' donation.user.username %}">{{ donation.user.username }}</a> + {% profile_link donation.user.username %} {% else %} {{ donation.donor }} {% endif %}
--- a/gpp/templates/downloads/download.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/downloads/download.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,6 @@ {% load url from future %} {% load comment_tags %} +{% load bio_tags %} {% get_comment_count for download as comment_count %} <dt> {{ download.title }} @@ -9,7 +10,7 @@ <table> <tr> <th>Added By:</th> - <td><a href="{% url 'bio-view_profile' download.user.username %}">{{ download.user.username }}</a></td> + <td>{% profile_link download.user.username %}</td> <th>Date:</th><td>{{ download.date_added|date:"M d, Y" }}</td> <th>Size:</th><td>{{ download.size }}</td> </tr>
--- a/gpp/templates/forums/display_post.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/display_post.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,11 +1,11 @@ {% load url from future %} -{% load avatar_tags %} +{% load bio_tags %} {% load forum_tags %} <tr class="forum-post {{ rowcolors }}" id="post-{{ post.id }}"> <td class="forum-post-author"> <a name="p{{ post.id }}"></a> - <a href="{% url 'bio-view_profile' username=post.user.username %}" title="View Profile for {{ post.user.username }}"><span class="post-author">{{ post.user.username }}</span></a><br /> - <a href="{% url 'bio-view_profile' username=post.user.username %}">{% avatar post.user %}</a><br /> + <span class="post-author">{% profile_link post.user.username %}</span><br /> + {% avatar post.user %}<br /> Joined: {{ post.user.date_joined|date:"M d, Y" }}<br /> Posts: {{ post.user.user_profile.forum_post_count }}<br /> {% if post.user.user_profile.location %}
--- a/gpp/templates/forums/forum_index.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/forum_index.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,6 +1,7 @@ {% extends 'base.html' %} {% load url from future %} {% load forum_tags %} +{% load bio_tags %} {% block custom_head %} {% if feed %} <link rel="alternate" type="application/rss+xml" title="{{ feed.name }}" href="{{ feed.feed }}" /> @@ -40,7 +41,7 @@ {% endif %} </td> <td class="forum-index_replies">{{ topic.reply_count }}</td> - <td class="forum-index_author"><a href="{% url 'bio-view_profile' username=topic.user.username %}" title="View profile for {{ topic.user.username }}">{{ topic.user.username }}</a></td> + <td class="forum-index_author">{% profile_link topic.user.username %}</td> <td class="forum-index_views">{{ topic.view_count }}</td> <td class="forum-index_last_post"> {% last_post_info topic.last_post %}
--- a/gpp/templates/forums/forum_stats_tag.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/forum_stats_tag.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,8 +1,9 @@ {% load url from future %} +{% load bio_tags %} {% load humanize %} <div id="forum-stats"> Our <strong>{{ user_count|intcomma }}</strong> users have posted a total of <strong>{{ post_count|intcomma }}</strong> posts.<br /> -The newest registered user is <a href="{% url 'bio-view_profile' username=latest_user %}">{{ latest_user }}</a>. +Our newest registered user is {% profile_link latest_user '.' %} {% if stats %} <br /> The most users ever online was <strong>{{ stats.max_users }}</strong> on {{ stats.max_users_date|date:"P l, N d, Y" }}.
--- a/gpp/templates/forums/last_post_info.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/last_post_info.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,9 +1,10 @@ {% load url from future %} +{% load bio_tags %} {% load forum_tags %} {% if post %} <a href="{{ post.get_absolute_url }}" title="Goto last post"><img src="{{ STATIC_URL }}icons/note_go.png" alt="Goto last post" /></a> <a href="{{ post.get_absolute_url }}" title="Goto last post">{% forum_date post.creation_date user %}</a><br /> -<a href="{% url 'bio-view_profile' username=post.user.username %}" title="View profile for {{ post.user.username }}">{{ post.user.username }}</a> +{% profile_link post.user.username %} {% else %} <i>No posts</i> {% endif %}
--- a/gpp/templates/forums/mod_forum.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/mod_forum.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% load forum_tags %} {% block title %}Moderate Forum: {{ forum.name }}{% endblock %} {% block custom_js %} @@ -29,7 +30,7 @@ class="forums-topic-icon" />{% endif %} <h4><a href="{{ topic.get_absolute_url }}">{{ topic.name }}</a></h4></td> <td class="forum-index_replies">{{ topic.reply_count }}</td> - <td class="forum-index_author"><a href="{% url 'bio-view_profile' username=topic.user.username %}" title="View profile for {{ topic.user.username }}">{{ topic.user.username }}</a></td> + <td class="forum-index_author">{% profile_link topic.user.username %}</td> <td class="forum-index_last_post"> {% last_post_info topic.last_post %} </td>
--- a/gpp/templates/forums/post_ip.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/post_ip.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,19 +1,19 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% block title %}Post IP Address Info: {{ post.user_ip }}{% endblock %} {% block content %} <h2>Post IP Address Info: {{ post.user_ip }}</h2> <p> This <a href="{{ post.get_absolute_url }}">post</a> was created by -<a href="{% url 'bio-view_profile' username=post.user.username %}">{{ post.user.username }}</a> from the IP address +{% profile_link post.user.username %} from the IP address <a href="http://www.dnsstuff.com/tools/whois/?ip={{ post.user_ip }}">{{ post.user_ip }}</a>. </p> {% if ip_users %} <p>All users who have posted from {{ post.user_ip }}:</p> <ul> {% for user in ip_users %} -<li><a href="{% url 'bio-view_profile' username=user %}">{{ user }}</a> - (<a href="{% url 'forums-posts_for_user' username=user %}">posts</a>)</li> +<li>{% profile_link user %} (<a href="{% url 'forums-posts_for_user' username=user %}">posts</a>)</li> {% endfor %} </ul> {% endif %}
--- a/gpp/templates/forums/spammer.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/spammer.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,12 +1,13 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% block title %}Deactivate Spammer: {{ post.user.username }}{% endblock %} {% block content %} <h2>Deactivate Spammer: {{ post.user.username }}</h2> {% if can_moderate and can_deactivate %} <p>Please confirm that you wish to mark the user -<a href="{% url 'bio-view_profile' username=post.user.username %}">{{ post.user.username }}</a> as a +{% profile_link post.user.username %} as a spammer based on <a href="{% url 'forums-goto_post' post.id %}">this post</a>. If you confirm, the user's account will be deactivated, and all posts and comments left by the user will be deleted.</p>
--- a/gpp/templates/forums/spammer_nailed.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/spammer_nailed.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,17 +1,18 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% block title %}Spammer Nailed: {{ spammer.username }}{% endblock %} {% block content %} <h2>Spammer Nailed: {{ spammer.username }}</h2> <p> {% if success %} -The user <a href="{% url 'bio-view_profile' username=spammer.username %}">{{ spammer.username }}</a> +The user {% profile_link spammer.username %} has had his/her account deactivated for spamming. All forum posts and comments this user has made have been deleted. The site admin has been notified of this action. Thanks for helping to keep our site spam-free! {% else %} Whoops, something went wrong deactivating the account of -<a href="{% url 'bio-view_profile' username=spammer.username %}">{{ spammer.username }}</a>. +{% profile_link spammer.username '.' %} Or, possibly some time has passed and the account was reinstated. If you have any questions, contact the site admin. {% endif %}
--- a/gpp/templates/forums/stranger.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/stranger.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% block title %}Promote Stranger: {{ post.user.username }}{% endblock %} {% block content %} <h2>Promote Stranger: {{ post.user.username }}</h2> @@ -12,7 +13,7 @@ and moderators won't be able to deactivate them on the spot. You may wish to wait until the user has posted at least 10 times before making your decision.</p> <p>Please confirm that you wish to promote the new user -<a href="{% url 'bio-view_profile' username=post.user.username %}">{{ post.user.username }}</a> from +{% profile_link post.user.username %} from <em>stranger</em> status based on <a href="{% url 'forums-goto_post' post.id %}">this post</a>. </p> <form action="." method="post">{% csrf_token %}
--- a/gpp/templates/forums/topic_list.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/forums/topic_list.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% load forum_tags %} {% block title %}Forums: {{ title }}{% endblock %} {% block custom_js %} @@ -33,7 +34,7 @@ {% endif %} </td> <td class="col-2"> - <a href="{% url 'bio-view_profile' username=topic.user.username %}" title="View profile for {{ topic.user.username }}">{{ topic.user.username }}</a> + {% profile_link topic.user.username %} </td> <td class="col-3"> {{ topic.reply_count }}
--- a/gpp/templates/membermap/balloon.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/membermap/balloon.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,7 +1,8 @@ {% load url from future %} +{% load bio_tags %} {% if avatar_url %} <a href="{% url 'bio-view_profile' username=user.name %}"> <img src="{{ avatar_url }}" alt="{{ user.name }}" style="float:left;margin-right:3px;" /></a> {% endif %} -<a href="{% url 'bio-view_profile' username=user.name %}">{{ user.name }}</a>:<br /> +{% profile_link user.name %}:<br /> {{ user.message|safe }}
--- a/gpp/templates/membermap/markdown.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/membermap/markdown.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,5 @@ {% load url from future %} {% load markup %} {% load smiley_tags %} -{% load avatar_tags %} -{% avatar user "left" %}<a href="{% url 'bio-view_profile' username=user.username %}">{{ user.username }}</a>:<br />{{ msg|safe }} +{% load bio_tags %} +{% avatar user 0 "left" %}{% profile_link user.username %}:<br />{{ msg|safe }}
--- a/gpp/templates/potd/view.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/potd/view.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% load url from future %} +{% load bio_tags %} {% load core_tags %} {% load comment_tags %} {% load script_tags %} @@ -29,8 +30,7 @@ <p class="caption">{{ potd.caption }}</p> <p class="details"> Submitted by -<a href="{% url 'bio-view_profile' username=potd.user.username %}">{{ potd.user.username }}</a> -on {{ potd.date_added|date:"d F Y" }}.<br /> +{% profile_link potd.user.username %} on {{ potd.date_added|date:"d F Y" }}.<br /> This photo has been Photo of the Day {{ potd.potd_count }} time{{ potd.potd_count|pluralize }}. </p> <div class="description">{{ potd.description|safe }}</div>
--- a/gpp/templates/shoutbox/shout_detail.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/shoutbox/shout_detail.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,9 +1,9 @@ {% load url from future %} -{% load avatar_tags %} +{% load bio_tags %} <tr> <th> -<a href="{% url 'bio-view_profile' username=shout.user.username %}">{% avatar shout.user %}</a><br /> -<a href="{% url 'bio-view_profile' username=shout.user.username %}">{{ shout.user.username }}</a> +{% avatar shout.user %}<br /> +{% profile_link shout.user.username %} </th> <td> <div {% ifequal user.id shout.user.id %}class="edit" id="shout-{{ shout.id }}"{% endifequal %}>{{ shout.html|safe }}</div>
--- a/gpp/templates/shoutbox/view.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/shoutbox/view.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load avatar_tags %} +{% load bio_tags %} {% load script_tags %} {% block custom_css %} <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/shoutbox_app.css" />
--- a/gpp/templates/weblinks/link.html Thu Oct 20 01:00:19 2011 +0000 +++ b/gpp/templates/weblinks/link.html Sat Oct 22 00:07:50 2011 +0000 @@ -1,4 +1,5 @@ {% load url from future %} +{% load bio_tags %} <dt> <h4><a href="{{ link.url }}">{{ link.title }}</a></h4> </dt> @@ -7,7 +8,7 @@ <form action="{% url 'weblinks-visit' link.id %}" method="post">{% csrf_token %} <table class="link-stats"> <tr> - <th>Added by:</th><td><a href="{% url 'bio-view_profile' link.user.username %}">{{ link.user.username }}</a></td> + <th>Added by:</th><td>{% profile_link link.user.username %}</td> <th>Category:</th><td><a href="{% url 'weblinks-view_links' slug=link.category.slug sort='date' %}">{{ link.category.title }}</a></td> </tr> <tr>