# Path: flask_editablesite/extensions.py

# 
# Path: flask_editablesite/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
# class Slugged(object):
# class TimeStamped(object):
# class Confirmable(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):
#     def validate_slug(self, key, value):
# def update_slug_before_save(mapper, connection, target):
#     def created_at_formatted(self):
#     def updated_at_formatted(self):
# def update_timestamps_before_insert(mapper, connection, target):
# def update_timestamps_before_update(mapper, connection, target):
#     def confirmed_at_formatted(self):
# def update_confirmedat_before_save(mapper, connection, target):


from flask import current_app as app
from flask_login import UserMixin
from sqlalchemy import event
from flask_editablesite.extensions import bcrypt
from flask_editablesite.database import (
    Column,
    db,
    Model,
    SurrogatePK,
    TimeStamped,
    Confirmable,
    update_timestamps_before_insert,
    update_timestamps_before_update,
    update_confirmedat_before_save,
)
        if self.first_name and self.last_name:
            return "{0} {1}".format(self.first_name, self.last_name)

        return ""

    @property
    def full_name_or_email(self):
        return self.full_name or self.email

    def __repr__(self):
        return '{0} <{1}>'.format(self.full_name, self.email)

    @classmethod
    def sessionstore_user(cls):
        """
        A dummy user object to represent the logged-in user when
        we're set to 'sessionstore' instead of 'db'.
        """

        return cls(
            email=app.config['SESSIONSTORE_USER_EMAIL'],
            first_name=app.config['SESSIONSTORE_USER_FIRST_NAME'],
            last_name=app.config['SESSIONSTORE_USER_LAST_NAME'],
            active=True)


event.listen(User, 'before_insert', update_timestamps_before_insert)
event.listen(User, 'before_update', update_timestamps_before_update)

event.listen(User, 'before_insert', update_confirmedat_before_save)

# Path: flask_editablesite/extensions.py

# 
# Path: flask_editablesite/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
# class Slugged(object):
# class TimeStamped(object):
# class Confirmable(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):
#     def validate_slug(self, key, value):
# def update_slug_before_save(mapper, connection, target):
#     def created_at_formatted(self):
#     def updated_at_formatted(self):
# def update_timestamps_before_insert(mapper, connection, target):
# def update_timestamps_before_update(mapper, connection, target):
#     def confirmed_at_formatted(self):
# def update_confirmedat_before_save(mapper, connection, target):


# Path: flask_editablesite/user/models.py
from flask import current_app as app
from flask_login import UserMixin
from sqlalchemy import event
from flask_editablesite.extensions import bcrypt
from flask_editablesite.database import (
    Column,
    db,
    Model,
    SurrogatePK,
    TimeStamped,
    Confirmable,
    update_timestamps_before_insert,
    update_timestamps_before_update,
    update_confirmedat_before_save,
)

        if self.first_name and self.last_name:
            return "{0} {1}".format(self.first_name, self.last_name)

        return ""

    @property
    def full_name_or_email(self):
        return self.full_name or self.email

    def __repr__(self):
        return '{0} <{1}>'.format(self.full_name, self.email)

    @classmethod
    def sessionstore_user(cls):
        """
        A dummy user object to represent the logged-in user when
        we're set to 'sessionstore' instead of 'db'.
        """

        return cls(
            email=app.config['SESSIONSTORE_USER_EMAIL'],
            first_name=app.config['SESSIONSTORE_USER_FIRST_NAME'],
            last_name=app.config['SESSIONSTORE_USER_LAST_NAME'],
            active=True)


event.listen(User, 'before_insert', update_timestamps_before_insert)
event.listen(User, 'before_update', update_timestamps_before_update)

event.listen(User, 'before_insert', update_confirmedat_before_save)

event.listen(User, 'before_update', update_confirmedat_before_save)