Mercurial > public > sg101
diff bandmap/admin.py @ 827:5103edd3acc4
Bandmap: initial version complete.
Javascript queries server for band data.
View created to handle query.
Test created for view.
Link added to map in sidebar.
Template tweaks.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 27 Sep 2014 19:41:41 -0500 |
parents | d7e4c08b2e8b |
children | b9973588af28 |
line wrap: on
line diff
--- a/bandmap/admin.py Sat Sep 27 15:14:47 2014 -0500 +++ b/bandmap/admin.py Sat Sep 27 19:41:41 2014 -0500 @@ -21,7 +21,7 @@ readonly_fields = ['lat', 'lon'] search_fields = ['name', 'location', 'note'] raw_id_fields = ['user'] - actions = ['approve_bands', 'update_location'] + actions = ['update_location', 'approve_bands'] def approve_bands(self, request, qs): """This admin action awards a map pin to the user who added the band. @@ -31,10 +31,12 @@ count = qs.count() now = datetime.datetime.now() for band in qs: - bio.badges.award_badge(bio.badges.MAP_PIN, band.user) - band.date_approved = now - band.is_approved = True - band.save() + if not band.is_approved: + if band.date_approved is None: + bio.badges.award_badge(bio.badges.MAP_PIN, band.user) + band.date_approved = now + band.is_approved = True + band.save() self.message_user(request, "%d band(s) approved." % count)