add timestamps to managemails models
This commit is contained in:
parent
9edbe6c898
commit
3473b14e62
1 changed files with 7 additions and 5 deletions
|
@ -1,11 +1,13 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from passlib.hash import sha512_crypt
|
from passlib.hash import sha512_crypt
|
||||||
|
from model_utils.models import TimeStampedModel
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class MailDomain(models.Model):
|
class MailDomain(TimeStampedModel, models.Model):
|
||||||
domain = models.CharField(max_length=128, unique=True)
|
domain = models.CharField(max_length=128, unique=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -28,7 +30,7 @@ class ActivateAbleMixin(models.Model):
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Mailbox(ActivateAbleMixin, models.Model):
|
class Mailbox(ActivateAbleMixin, TimeStampedModel, models.Model):
|
||||||
username = models.CharField(max_length=128, unique=True)
|
username = models.CharField(max_length=128, unique=True)
|
||||||
password = models.CharField(max_length=255)
|
password = models.CharField(max_length=255)
|
||||||
home = models.CharField(max_length=255)
|
home = models.CharField(max_length=255)
|
||||||
|
@ -47,7 +49,7 @@ class Mailbox(ActivateAbleMixin, models.Model):
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class MailAddress(ActivateAbleMixin, models.Model):
|
class MailAddress(ActivateAbleMixin, TimeStampedModel, models.Model):
|
||||||
localpart = models.CharField(max_length=128)
|
localpart = models.CharField(max_length=128)
|
||||||
domain = models.ForeignKey(MailDomain)
|
domain = models.ForeignKey(MailDomain)
|
||||||
|
|
||||||
|
@ -60,7 +62,7 @@ class MailAddress(ActivateAbleMixin, models.Model):
|
||||||
return "{0}@{1}".format(self.localpart, self.domain)
|
return "{0}@{1}".format(self.localpart, self.domain)
|
||||||
|
|
||||||
|
|
||||||
class MailAddressMailbox(models.Model):
|
class MailAddressMailbox(TimeStampedModel, models.Model):
|
||||||
mailaddress = models.OneToOneField(MailAddress, primary_key=True)
|
mailaddress = models.OneToOneField(MailAddress, primary_key=True)
|
||||||
mailbox = models.ForeignKey(Mailbox)
|
mailbox = models.ForeignKey(Mailbox)
|
||||||
|
|
||||||
|
@ -68,7 +70,7 @@ class MailAddressMailbox(models.Model):
|
||||||
unique_together = ('mailaddress', 'mailbox')
|
unique_together = ('mailaddress', 'mailbox')
|
||||||
|
|
||||||
|
|
||||||
class MailAddressForward(models.Model):
|
class MailAddressForward(TimeStampedModel, models.Model):
|
||||||
mailaddress = models.ForeignKey(MailAddress)
|
mailaddress = models.ForeignKey(MailAddress)
|
||||||
target = models.EmailField(max_length=254)
|
target = models.EmailField(max_length=254)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue