# Path: app/crud_mixin.py
# class CRUDMixin(object):
#     """ Helper class flask-sqlalchemy entities """
#     __table_args__ = {'extend_existing': True}
# 
#     id = db.Column(db.Integer, primary_key=True)
# 
#     @classmethod
#     def get_by_id(cls, id):
#         if any(
#             (isinstance(id, basestring) and id.isdigit(),
#              isinstance(id, (int, float))),
#         ):
#             return cls.query.get(int(id))
#         return None
# 
# 
#     @classmethod
#     def create(cls, **kwargs):
#         """ Helper for session.add() + session.commit() """
#         instance = cls(**kwargs)
#         return instance.save()
# 
# 
#     def update(self, commit=True, **kwargs):
#         for attr, value in kwargs.iteritems():
#             setattr(self, attr, value)
#         return commit and self.save() or self
# 
# 
#     def save(self, commit=True):
#         db.session.add(self)
#         if commit:
#             db.session.commit()
#         return self
# 
# 
#     def delete(self, commit=True):
#         db.session.delete(self)
#         return commit and db.session.commit()
# 
# Path: app/main.py



from app.crud_mixin import CRUDMixin
from app.main import db
"""
ORM for LogType table
"""

LOG_TYPE_ACCOUNT_CREATED = 'account_created'
LOG_TYPE_LOGIN = 'login'
LOG_TYPE_LOGOUT = 'logout'
LOG_TYPE_LOGIN_ERROR = 'login_error'
LOG_TYPE_ACCOUNT_MODIFIED = 'account_modified'



# Path: app/crud_mixin.py
# class CRUDMixin(object):
#     """ Helper class flask-sqlalchemy entities """
#     __table_args__ = {'extend_existing': True}
# 
#     id = db.Column(db.Integer, primary_key=True)
# 
#     @classmethod
#     def get_by_id(cls, id):
#         if any(
#             (isinstance(id, basestring) and id.isdigit(),
#              isinstance(id, (int, float))),
#         ):
#             return cls.query.get(int(id))
#         return None
# 
# 
#     @classmethod
#     def create(cls, **kwargs):
#         """ Helper for session.add() + session.commit() """
#         instance = cls(**kwargs)
#         return instance.save()
# 
# 
#     def update(self, commit=True, **kwargs):
#         for attr, value in kwargs.iteritems():
#             setattr(self, attr, value)
#         return commit and self.save() or self
# 
# 
#     def save(self, commit=True):
#         db.session.add(self)
#         if commit:
#             db.session.commit()
#         return self
# 
# 
#     def delete(self, commit=True):
#         db.session.delete(self)
#         return commit and db.session.commit()
# 
# Path: app/main.py



# Path: app/models/log_type_entity.py
from app.crud_mixin import CRUDMixin
from app.main import db

"""
ORM for LogType table
"""

LOG_TYPE_ACCOUNT_CREATED = 'account_created'
LOG_TYPE_LOGIN = 'login'
LOG_TYPE_LOGOUT = 'logout'
LOG_TYPE_LOGIN_ERROR = 'login_error'
LOG_TYPE_ACCOUNT_MODIFIED = 'account_modified'



class LogTypeEntity(db.Model, CRUDMixin):