Mercurial > public > sg101
changeset 822:2c4f28b1c12a
Band map WIP: update admin dashboard for new band map entries.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 24 Sep 2014 19:53:36 -0500 |
parents | 71db8076dc3d |
children | 5892c05886a9 |
files | bandmap/models.py core/templatetags/custom_admin_tags.py sg101/templates/core/admin_dashboard.html |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bandmap/models.py Tue Sep 23 20:40:31 2014 -0500 +++ b/bandmap/models.py Wed Sep 24 19:53:36 2014 -0500 @@ -7,6 +7,11 @@ from django.contrib.auth.models import User +class BandEntryManager(models.Manager): + def new_entry_count(self): + return self.filter(is_approved=False).count() + + class BandEntry(models.Model): """Represents a band entry on the band map.""" name = models.CharField(max_length=128) @@ -21,6 +26,8 @@ is_active = models.BooleanField(default=True, db_index=True) is_approved = models.BooleanField(default=False, db_index=True) + objects = BandEntryManager() + class Meta: ordering = ['name'] verbose_name_plural = 'band map entries'
--- a/core/templatetags/custom_admin_tags.py Tue Sep 23 20:40:31 2014 -0500 +++ b/core/templatetags/custom_admin_tags.py Wed Sep 24 19:53:36 2014 -0500 @@ -13,6 +13,7 @@ from weblinks.models import PendingLink, FlaggedLink from shoutbox.models import ShoutFlag from messages.models import Flag as PmFlag +from bandmap.models import BandEntry register = template.Library() @@ -37,6 +38,7 @@ broken_links = FlaggedLink.objects.count() flagged_shouts = ShoutFlag.objects.count() flagged_msgs = PmFlag.objects.count() + new_bands = BandEntry.objects.new_entry_count() return { 'user': user, @@ -50,4 +52,5 @@ 'broken_links': broken_links, 'flagged_shouts': flagged_shouts, 'flagged_msgs': flagged_msgs, + 'new_bands': new_bands, }
--- a/sg101/templates/core/admin_dashboard.html Tue Sep 23 20:40:31 2014 -0500 +++ b/sg101/templates/core/admin_dashboard.html Wed Sep 24 19:53:36 2014 -0500 @@ -1,5 +1,5 @@ {% if user.is_staff %} -{% if flagged_posts or flagged_comments or flagged_profiles or event_requests or new_stories or new_downloads or new_links or flagged_shouts or broken_links or flagged_msgs %} +{% if flagged_posts or flagged_comments or flagged_profiles or event_requests or new_stories or new_downloads or new_links or flagged_shouts or broken_links or flagged_msgs or new_bands %} <ul id="dashboard-list"> {% if flagged_posts %} <li><a href="/admin/forums/flaggedpost/">Posts</a>: {{ flagged_posts }}</li> @@ -31,6 +31,9 @@ {% if flagged_msgs %} <li><a href="/admin/messages/flag/">PM's</a>: {{ flagged_msgs }}</li> {% endif %} +{% if new_bands %} +<li><a href="/admin/bandmap/bandentry/">Band Map</a>: {{ new_bands }}</li> +{% endif %} </ul> {% endif %} {% endif %}