Commit bdacc764 by Adam Palay

clean up track/models

parent 03aee3ed
from django.db import models from django.db import models
from django.db import models
class TrackingLog(models.Model): class TrackingLog(models.Model):
"""Defines the fields that are stored in the tracking log database"""
dtcreated = models.DateTimeField('creation date', auto_now_add=True) dtcreated = models.DateTimeField('creation date', auto_now_add=True)
username = models.CharField(max_length=32, blank=True) username = models.CharField(max_length=32, blank=True)
ip = models.CharField(max_length=32, blank=True) ip = models.CharField(max_length=32, blank=True)
...@@ -16,6 +15,9 @@ class TrackingLog(models.Model): ...@@ -16,6 +15,9 @@ class TrackingLog(models.Model):
host = models.CharField(max_length=64, blank=True) host = models.CharField(max_length=64, blank=True)
def __unicode__(self): def __unicode__(self):
s = "[%s] %s@%s: %s | %s | %s | %s" % (self.time, self.username, self.ip, self.event_source, fmt = (
self.event_type, self.page, self.event) u"[{self.time}] {self.username}@{self.ip}: "
return s u"{self.event_source}| {self.event_type} | "
u"{self.page} | {self.event}"
)
return fmt.format(self=self)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment