annotate gpp/core/models.py @ 3:33f73b7bd305
Adjusted weblinks link template. Use an icon for reporting broken link.
author |
Brian Neal <bgneal@gmail.com> |
date |
Sat, 11 Apr 2009 18:28:13 +0000 |
parents |
f3ad863505bf |
children |
91fd31dc78fb |
rev |
line source |
gremmie@1
|
1 """
|
gremmie@1
|
2 This file contains the core Models used in gpp.
|
gremmie@1
|
3 """
|
gremmie@1
|
4
|
gremmie@1
|
5 from django.db import models
|
gremmie@1
|
6
|
gremmie@1
|
7
|
gremmie@1
|
8 class DebugLog(models.Model):
|
gremmie@1
|
9 '''Model to represent debug logs used during development; arbitary text can be stored'''
|
gremmie@1
|
10
|
gremmie@1
|
11 LOG_LEVELS = (
|
gremmie@1
|
12 (0, 'Not Set'),
|
gremmie@1
|
13 (10, 'Debug'),
|
gremmie@1
|
14 (20, 'Info'),
|
gremmie@1
|
15 (30, 'Warning'),
|
gremmie@1
|
16 (40, 'Error'),
|
gremmie@1
|
17 (50, 'Critical'),
|
gremmie@1
|
18 )
|
gremmie@1
|
19
|
gremmie@1
|
20 timestamp = models.DateTimeField(auto_now_add = True)
|
gremmie@1
|
21 level = models.IntegerField(choices = LOG_LEVELS)
|
gremmie@1
|
22 msg = models.TextField()
|
gremmie@1
|
23
|
gremmie@1
|
24 def __unicode__(self):
|
gremmie@1
|
25 return '%s - %s' % (self.timestamp.strftime('%m/%d/%Y %H:%M:%S'),
|
gremmie@1
|
26 self.msg[:64])
|
gremmie@1
|
27
|
gremmie@1
|
28 class Meta:
|
gremmie@1
|
29 ordering = ('-timestamp', )
|