Permalink
Browse files

Fixed a little bug that wasn't allowing us to sort Hits by date in th…

…e admin -- should work now.
  • Loading branch information...
1 parent 1781414 commit f9f72343e6f1500fa820073628f2a5db520ecb06 @thornomad committed Feb 15, 2010
Showing with 8 additions and 2 deletions.
  1. +5 −0 .gitignore
  2. +2 −1 hitcount/admin.py
  3. +1 −1 hitcount/models.py
View
5 .gitignore
@@ -0,0 +1,5 @@
+*.pyc
+*~
+.DS_Store
+.AppleDouble
+*.swp
View
3 hitcount/admin.py
@@ -7,9 +7,10 @@ def created_format(obj):
'''
Format the created time for the admin. PS: I am not happy with this.
'''
- return "%s" % obj.created.strftime("%H:%M:%S<br />%m.%d.%y")
+ return "%s" % obj.created.strftime("%m/%d/%y<br />%H:%M:%S")
created_format.short_description = "Date (UTC)"
created_format.allow_tags = True
+created_format.admin_order_field = 'created'
class HitAdmin(admin.ModelAdmin):
View
2 hitcount/models.py
@@ -63,7 +63,6 @@ def filter_active(self, *args, **kwargs):
'''
grace = getattr(settings, 'HITCOUNT_KEEP_HIT_ACTIVE', {'days':7})
period = datetime.datetime.utcnow() - datetime.timedelta(**grace)
-
queryset = self.get_query_set()
queryset = queryset.filter(created__gte=period)
return queryset.filter(*args, **kwargs)
@@ -201,6 +200,7 @@ def delete(self, save_hitcount=False):
super(Hit, self).delete()
+
class BlacklistIP(models.Model):
ip = models.CharField(max_length=40, unique=True)

0 comments on commit f9f7234

Please sign in to comment.