python3 compat and deps++
This commit is contained in:
1 parent
88eeabe746
commit
5efea835d0
9 files changed
+58
-64
No files matched your search
+7
-3
@@ -1,5 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
|
||||
class BaseModel(models.Model):
|
||||
@@ -10,13 +11,14 @@ class BaseModel(models.Model):
|
||||
abstract = True
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Alias(BaseModel):
|
||||
source = models.EmailField(max_length=254)
|
||||
destination = models.EmailField(max_length=254)
|
||||
domain = models.ForeignKey('dpdapi.Domain')
|
||||
active = models.BooleanField(default=True)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return "{}={}".format(self.source, self.destination)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
@@ -30,10 +32,11 @@ class Alias(BaseModel):
|
||||
unique_together = ('source', 'destination', 'domain')
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Domain(BaseModel):
|
||||
name = models.CharField(max_length=254, unique=True)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
@@ -42,12 +45,13 @@ class Domain(BaseModel):
|
||||
super(Domain, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class User(BaseModel):
|
||||
email = models.EmailField(max_length=254, unique=True)
|
||||
password = models.CharField(max_length=109)
|
||||
domain = models.ForeignKey('dpdapi.Domain')
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.email
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
||||
Reference in new issue
Block a user