view gpp/core/models.py @ 13:777451a98f9d

Shoutbox work: shouts now have absolute URLs. Shouts can now be flagged as abuse. Minor tweak to breadcrumbs css. Added flag date to comments admin.
author Brian Neal <bgneal@gmail.com>
date Thu, 16 Apr 2009 02:00:17 +0000
parents f3ad863505bf
children 91fd31dc78fb
line wrap: on
line source
"""
This file contains the core Models used in gpp.
"""

from django.db import models


class DebugLog(models.Model):
   '''Model to represent debug logs used during development; arbitary text can be stored'''

   LOG_LEVELS = (
      (0, 'Not Set'),
      (10, 'Debug'),
      (20, 'Info'),
      (30, 'Warning'),
      (40, 'Error'),
      (50, 'Critical'),
   )

   timestamp = models.DateTimeField(auto_now_add = True)
   level = models.IntegerField(choices = LOG_LEVELS)
   msg = models.TextField()

   def __unicode__(self):
      return '%s - %s' % (self.timestamp.strftime('%m/%d/%Y %H:%M:%S'),
            self.msg[:64])

   class Meta:
      ordering = ('-timestamp', )