diff --git a/admin/freeposte/models.py b/admin/freeposte/models.py index b0eca45a..281005a4 100644 --- a/admin/freeposte/models.py +++ b/admin/freeposte/models.py @@ -2,6 +2,7 @@ from freeposte import db from sqlalchemy.ext import declarative from passlib import context +from datetime import datetime # Many-to-many association table for domain administrators @@ -16,7 +17,17 @@ admins = db.Table('admin', ) -class Domain(db.Model): +class Base(db.Model): + """ Base class for all models + """ + + __abstract__ = True + + created_at = db.Column(db.Date, nullable=False, default=datetime.now) + updated_at = db.Column(db.Date, nullable=True, onupdate=datetime.now) + + +class Domain(Base): """ A DNS domain that has mail addresses associated to it. """ name = db.Column(db.String(80), primary_key=True, nullable=False) @@ -29,7 +40,7 @@ class Domain(db.Model): return self.name -class Address(db.Model): +class Address(Base): """ Abstraction for a mail address (localpart and domain). """ __abstract__ = True diff --git a/admin/freeposte/templates/alias/list.html b/admin/freeposte/templates/alias/list.html index d8875c7e..cd4888d8 100644 --- a/admin/freeposte/templates/alias/list.html +++ b/admin/freeposte/templates/alias/list.html @@ -19,6 +19,8 @@ Alias list Actions Address Destination + Created + Last edit {% for alias in domain.aliases %} @@ -28,6 +30,8 @@ Alias list {{ alias }} {{ alias.destination or '-' }} + {{ alias.created_at }} + {{ alias.updated_at or '' }} {% endfor %} diff --git a/admin/freeposte/templates/domain/list.html b/admin/freeposte/templates/domain/list.html index 2da82c04..f0dbe5fc 100644 --- a/admin/freeposte/templates/domain/list.html +++ b/admin/freeposte/templates/domain/list.html @@ -18,6 +18,8 @@ Domain list Domain name Mailbox count Alias count + Created + Last edit {% for domain in current_user.get_managed_domains() %} @@ -31,6 +33,8 @@ Domain list {{ domain.name }} {{ domain.users | count }} / {{ domain.max_users or '∞' }} {{ domain.aliases | count }} / {{ domain.max_aliases or '∞' }} + {{ domain.created_at }} + {{ domain.updated_at or '' }} {% endfor %} diff --git a/admin/freeposte/templates/user/list.html b/admin/freeposte/templates/user/list.html index 084a1f7d..a049bccf 100644 --- a/admin/freeposte/templates/user/list.html +++ b/admin/freeposte/templates/user/list.html @@ -18,8 +18,12 @@ User list Actions Address + Name Forward + Reply Quota + Created + Last edit {% for user in domain.users %} @@ -33,8 +37,12 @@ User list {{ user }} - {{ user.forward or '-' }} + {{ user.displayed_name }} + {% if user.forward %}enabled{% endif %} + {% if user.reply_subject %}enabled{% endif %} {{ user.quota_bytes | filesizeformat }} + {{ user.created_at }} + {{ user.updated_at or '' }} {% endfor %}