1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-26 03:52:50 +02:00
Mailu/admin/freeposte/models.py
2016-02-20 20:11:59 +01:00

36 lines
1.0 KiB
Python

from freeposte import db
class Domain(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
max_users = db.Column(db.Integer)
max_aliases = db.Column(db.Integer)
def __str__(self):
return self.name
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80))
domain_id = db.Column(db.Integer, db.ForeignKey(Domain.id))
domain = db.relationship(Domain, backref='users')
password = db.Column(db.String(255))
quota_bytes = db.Column(db.Integer())
def __str__(self):
return '{0}@{1}'.format(self.username, self.domain.name)
class Alias(db.Model):
id = db.Column(db.Integer, primary_key=True)
localpart = db.Column(db.String(80))
domain_id = db.Column(db.Integer, db.ForeignKey(Domain.id))
domain = db.relationship(Domain, backref='aliases')
destination = db.Column(db.String())
def __str__(self):
return '{0}@{1}'.format(self.username, self.domain.name)