annotate gpp/core/models.py @ 6:b6263ac72052
Use DRY principle to manage third party javascript libraries. Created script_tags template tags to generate the correct link and script tags for 3rd party libraries. The settings.py file is the only place where the full path name is specified.
author |
Brian Neal <bgneal@gmail.com> |
date |
Sat, 11 Apr 2009 22:50:56 +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', )
|