Ticket #4140: models.py

File models.py, 2.3 KB (added by frank.hoffsummer@…, 18 years ago)

model that causes the syncdb error

Line 
1#-*- coding: UTF-8 -*-
2from django.db import models
3from mcc.config.models import Channel
4
5LOGLEVELS = { 1: "ERROR", 2: "WARNING", 3: "INFO" }
6
7class JobStatus(models.Model):
8 jobid = models.CharField(maxlength=255,unique=True)
9 edition = models.ForeignKey(Channel, blank=True, null=True)
10 started = models.DateTimeField('startad', blank=True, null=True)
11 status = models.CharField(maxlength=255, blank=True, null=True)
12 finished = models.DateTimeField('slutad', blank=True, null=True)
13 sourcefilename = models.CharField(maxlength=255, blank=True, null=True)
14 sourcefilesize = models.IntegerField(blank=True, null=True)
15 convertedfilename = models.CharField(maxlength=255, blank=True, null=True)
16 convertedfilesize = models.IntegerField(blank=True, null=True)
17 conversionprogress = models.IntegerField(blank=True, null=True)
18 conversionstatus = models.CharField(maxlength=255, blank=True, null=True)
19 filetransferstatus = models.CharField(maxlength=255, blank=True, null=True)
20 publishedstatus = models.CharField(maxlength=255, blank=True, null=True)
21 def __str__(self):
22 return self.jobid
23 class Meta:
24 verbose_name = "Jobbstatus"
25 verbose_name_plural = "Jobbstatus"
26 class Admin:
27 list_display = ('jobid', 'edition', 'sourcefilename', 'convertedfilesize', 'started', 'finished', 'status')
28 search_fields = ['sourcefilename', 'edition']
29 date_hierarchy = 'started'
30 list_filter = ['status']
31
32
33class LogMessage(models.Model):
34 timestamp = models.DateTimeField('Log Date', auto_now_add=True)
35 level = models.IntegerField()
36 message = models.TextField(core=True)
37 filename = models.CharField('Filename', maxlength=100, blank=True)
38 edition = models.ForeignKey(Channel, blank=True, null=True)
39 jobstatus = models.ForeignKey(JobStatus,blank=True,null=True,edit_inline=models.TABULAR, num_in_admin=1, max_num_in_admin=10)
40 def __str__(self):
41 return "%s %s" % (self.level, self.message)
42 def levelString(self):
43 return LOGLEVELS[self.level]
44 class Meta:
45 verbose_name = "Loggmeddelande"
46 verbose_name_plural = "Loggmeddelanden"
47 class Admin:
48 list_display = ('timestamp', 'level', 'message', 'filename', 'edition')
49 search_fields = ['source', 'message', 'filename']
50 date_hierarchy = 'timestamp'
Back to Top