# HG changeset patch # User Brian Neal # Date 1260316990 0 # Node ID 71cb4208dc98ac1517dba58243c2d35c58e7de80 # Parent 49b713bca29dfb22ae855c9548369de6e984784a Tweak to #30, admin dashboard. Because of a bug in Django (9568), my dashboard appears on the login page. To get around this, pass in the user to the templatetag, so it can do a 'if user.is_staff' check. Also tweaked the HTML and CSS to show non-zero pending items in red. Shortened the pending item titles for readability. diff -r 49b713bca29d -r 71cb4208dc98 gpp/core/templatetags/custom_admin_tags.py --- a/gpp/core/templatetags/custom_admin_tags.py Sun Dec 06 21:44:22 2009 +0000 +++ b/gpp/core/templatetags/custom_admin_tags.py Wed Dec 09 00:03:10 2009 +0000 @@ -17,7 +17,7 @@ @register.inclusion_tag('core/admin_dashboard.html') -def admin_dashboard(): +def admin_dashboard(user): """ This tag is used in the admin to create a dashboard of pending content that an admin must approve. @@ -34,6 +34,7 @@ new_links = Link.objects.filter(is_public=False).count() return { + 'user': user, 'flagged_profiles': flagged_profiles, 'flagged_comments': flagged_comments, 'new_downloads': new_downloads, diff -r 49b713bca29d -r 71cb4208dc98 gpp/templates/admin/base_site.html --- a/gpp/templates/admin/base_site.html Sun Dec 06 21:44:22 2009 +0000 +++ b/gpp/templates/admin/base_site.html Wed Dec 09 00:03:10 2009 +0000 @@ -14,6 +14,10 @@ margin-right: 10px; margin-bottom: 4px; } + #dashboard-list .alert { + color: #f55; + font-weight: bold; + } {% endblock %} @@ -23,4 +27,4 @@

{% trans 'SurfGuitar101.com Site Administration' %}

{% endblock %} -{% block nav-global %}{% admin_dashboard %}{% endblock %} +{% block nav-global %}{% admin_dashboard user %}{% endblock %} diff -r 49b713bca29d -r 71cb4208dc98 gpp/templates/core/admin_dashboard.html --- a/gpp/templates/core/admin_dashboard.html Sun Dec 06 21:44:22 2009 +0000 +++ b/gpp/templates/core/admin_dashboard.html Wed Dec 09 00:03:10 2009 +0000 @@ -1,9 +1,18 @@ +{% if user.is_staff %} +{% endif %}