PageRenderTime 20ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/baruwa/status/models.py

https://bitbucket.org/datopdog/baruwa
Python | 44 lines | 20 code | 4 blank | 20 comment | 0 complexity | 774d5265d2bb0575e7cd4baf884d5320 MD5 | raw file
Possible License(s): GPL-2.0
 1# 
 2# Baruwa - Web 2.0 MailScanner front-end.
 3# Copyright (C) 2010-2011  Andrew Colin Kissa <andrew@topdog.za.net>
 4# 
 5# This program is free software; you can redistribute it and/or modify
 6# it under the terms of the GNU General Public License as published by
 7# the Free Software Foundation; either version 2 of the License, or
 8# (at your option) any later version.
 9# 
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14# 
15# You should have received a copy of the GNU General Public License along
16# with this program; if not, write to the Free Software Foundation, Inc.,
17# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18#
19# vim: ai ts=4 sts=4 et sw=4
20#
21
22"Status models"
23from django.db import models
24
25
26class MailQueueItem(models.Model):
27    "MailQ item"
28    id = models.AutoField(primary_key=True)
29    messageid = models.CharField(max_length=255)
30    timestamp = models.DateTimeField()
31    from_address = models.CharField(blank=True, db_index=True, max_length=255)
32    to_address = models.CharField(db_index=True, max_length=255)
33    subject = models.TextField(blank=True)
34    hostname = models.TextField()
35    size = models.IntegerField()
36    attempts = models.IntegerField()
37    lastattempt = models.DateTimeField()
38    direction = models.IntegerField(default=1)
39    reason = models.TextField(blank=True)
40
41    class Meta:
42        db_table = u'mailq'
43        get_latest_by = 'timestamp'
44        ordering = ['-timestamp']