Skip to content
This repository
Browse code

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

…e admin -- should work now.
  • Loading branch information...
commit f9f72343e6f1500fa820073628f2a5db520ecb06 1 parent 1781414
Damon Timm authored

Showing 3 changed files with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. +5 0 .gitignore
  2. +2 1  hitcount/admin.py
  3. +1 1  hitcount/models.py
5 .gitignore
... ... @@ -0,0 +1,5 @@
  1 +*.pyc
  2 +*~
  3 +.DS_Store
  4 +.AppleDouble
  5 +*.swp
3  hitcount/admin.py
@@ -7,9 +7,10 @@ def created_format(obj):
7 7 '''
8 8 Format the created time for the admin. PS: I am not happy with this.
9 9 '''
10   - return "%s" % obj.created.strftime("%H:%M:%S<br />%m.%d.%y")
  10 + return "%s" % obj.created.strftime("%m/%d/%y<br />%H:%M:%S")
11 11 created_format.short_description = "Date (UTC)"
12 12 created_format.allow_tags = True
  13 +created_format.admin_order_field = 'created'
13 14
14 15
15 16 class HitAdmin(admin.ModelAdmin):
2  hitcount/models.py
@@ -63,7 +63,6 @@ def filter_active(self, *args, **kwargs):
63 63 '''
64 64 grace = getattr(settings, 'HITCOUNT_KEEP_HIT_ACTIVE', {'days':7})
65 65 period = datetime.datetime.utcnow() - datetime.timedelta(**grace)
66   -
67 66 queryset = self.get_query_set()
68 67 queryset = queryset.filter(created__gte=period)
69 68 return queryset.filter(*args, **kwargs)
@@ -201,6 +200,7 @@ def delete(self, save_hitcount=False):
201 200 super(Hit, self).delete()
202 201
203 202
  203 +
204 204 class BlacklistIP(models.Model):
205 205 ip = models.CharField(max_length=40, unique=True)
206 206

0 comments on commit f9f7234

Please sign in to comment.
Something went wrong with that request. Please try again.