Add creation and registration dates.

This commit is contained in:
Stephan Porada 2019-08-06 14:26:22 +02:00
parent 5a67164dbe
commit 175dbceac6

View File

@ -4,6 +4,7 @@ from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from werkzeug.security import generate_password_hash, check_password_hash from werkzeug.security import generate_password_hash, check_password_hash
from . import db from . import db
from . import login_manager from . import login_manager
from datetime import datetime
class Permission: class Permission:
@ -106,6 +107,7 @@ class User(UserMixin, db.Model):
# Primary key # Primary key
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
confirmed = db.Column(db.Boolean, default=False) confirmed = db.Column(db.Boolean, default=False)
registration_date = db.Column(db.DateTime(), default=datetime.utcnow)
email = db.Column(db.String(64), unique=True, index=True) email = db.Column(db.String(64), unique=True, index=True)
password_hash = db.Column(db.String(128)) password_hash = db.Column(db.String(128))
role_id = db.Column(db.Integer, db.ForeignKey('roles.id')) role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))
@ -203,6 +205,7 @@ class AnonymousUser(AnonymousUserMixin):
""" """
Model replaces the default AnonymousUser. Model replaces the default AnonymousUser.
""" """
def can(self, permissions): def can(self, permissions):
return False return False
@ -217,6 +220,7 @@ class Job(db.Model):
__tablename__ = 'jobs' __tablename__ = 'jobs'
# Primary key # Primary key
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
creation_date = db.Column(db.DateTime(), default=datetime.utcnow)
description = db.Column(db.String(64)) description = db.Column(db.String(64))
''' '''
' Requested ressources. ' Requested ressources.