Previous topic

base.forms module

Next topic

base.tests module

This Page

base.models module

the most common models for the whole project.

copyright:(c) 2012 by roman semirook.
license:bsd, see license for more details.
class base.models.CRUDMixin[source]

Bases: object

classmethod create(**kwargs)[source]
delete(commit=True)[source]
classmethod get_by_id(id)[source]
id = Column(None, Integer(), table=None, primary_key=True, nullable=False)
save(commit=True)[source]
update(commit=True, **kwargs)[source]
class base.models.User(username, email, password)[source]

Bases: flask_login.UserMixin, base.models.CRUDMixin, flask_sqlalchemy.Model

A basic user model, sufficient for authorization support.

Note that email is defined as unique, so we’ll be able to find a specific user given her email (get_by_email()).

The primary key is inherited from CRUDMixin (:attr::CRUDMixin.id)

__init__(username, email, password)[source]
check_password(password)[source]

Checks a password against a given salted and hashed password value, using werkzeug.security tools

Parameters:password
Returns:
email
classmethod get_by_email(email)[source]

Retrieves a user from her email.

Parameters:
  • cls
  • email
Returns:

id
password
username