hapcat.models

Hapcat database models.

class hapcat.models.Event(**kwargs)[source]

Bases: hapcat.models.Votable

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e27183160; Event>
__mapper_args__ = {'polymorphic_identity': 'event'}
__module__ = 'hapcat.models'
__table__ = Table('event', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('votable.id'), table=<event>, primary_key=True, nullable=False), Column('rawlocation_id', UUIDType(length=16), ForeignKey('rawlocation.id'), table=<event>, nullable=False), schema=None)
__tablename__ = 'event'
_sa_class_manager = <ClassManager of <class 'hapcat.models.Event'> at 7f0e2717be58>
id
name
rawlocation
rawlocation_id
serialize()[source]
type
class hapcat.models.Location(**kwargs)[source]

Bases: hapcat.models.Votable

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e271715c0; Location>
__mapper_args__ = {'polymorphic_identity': 'location'}
__module__ = 'hapcat.models'
__table__ = Table('location', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('votable.id'), table=<location>, primary_key=True, nullable=False), Column('rawlocation_id', UUIDType(length=16), ForeignKey('rawlocation.id'), table=<location>, nullable=False), schema=None)
__tablename__ = 'location'
_sa_class_manager = <ClassManager of <class 'hapcat.models.Location'> at 7f0e2717b318>
id
name
rawlocation
rawlocation_id
serialize()[source]
type
class hapcat.models.Photo(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e27183748; Photo>
__mapper_args__ = {'polymorphic_identity': 'photo'}
__module__ = 'hapcat.models'
__table__ = Table('photo', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<photo>, primary_key=True, nullable=False), Column('photourl', URLType(), table=<photo>, nullable=False), schema=None)
__tablename__ = 'photo'
_sa_class_manager = <ClassManager of <class 'hapcat.models.Photo'> at 7f0e2718e7c8>
id
photourl
type
votables

A descriptor that presents a read/write view of an object attribute.

class hapcat.models.RawLocation(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e271bfc88; RawLocation>
__mapper_args__ = {'polymorphic_identity': 'rawlocation'}
__module__ = 'hapcat.models'
__table__ = Table('rawlocation', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<rawlocation>, primary_key=True, nullable=False), Column('address', UnicodeText(), table=<rawlocation>, nullable=False), schema=None)
__tablename__ = 'rawlocation'
_sa_class_manager = <ClassManager of <class 'hapcat.models.RawLocation'> at 7f0e27167958>
address
id
serialize()[source]
type
class hapcat.models.Secret(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e27199f60; Secret>
__module__ = 'hapcat.models'
__table__ = Table('secret', MetaData(bind=None), Column('id', Unicode(), table=<secret>, primary_key=True, nullable=False), Column('payload', LargeBinary(), table=<secret>, nullable=False), schema=None)
__tablename__ = 'secret'
_sa_class_manager = <ClassManager of <class 'hapcat.models.Secret'> at 7f0e2712d048>
id
payload
class hapcat.models.Tag(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e291112b0; Tag>
__mapper_args__ = {'polymorphic_identity': 'tag'}
__module__ = 'hapcat.models'
__table__ = Table('tag', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<tag>, primary_key=True, nullable=False), Column('name', UnicodeText(), table=<tag>, nullable=False), schema=None)
__tablename__ = 'tag'
_sa_class_manager = <ClassManager of <class 'hapcat.models.Tag'> at 7f0e271c9f98>
id
name
serialize()[source]
type
class hapcat.models.UUIDObject(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e271bf630; UUIDObject>
__mapper_args__ = {'polymorphic_on': Column('type', String(length=32), table=<uuidobject>), 'polymorphic_identity': 'uuidobject'}
__module__ = 'hapcat.models'
__table__ = Table('uuidobject', MetaData(bind=None), Column('id', UUIDType(length=16), table=<uuidobject>, primary_key=True, nullable=False), Column('type', String(length=32), table=<uuidobject>), schema=None)
__tablename__ = 'uuidobject'
_sa_class_manager = <ClassManager of <class 'hapcat.models.UUIDObject'> at 7f0e271c9688>
id
type
class hapcat.models.User(id, username, email, date_of_birth, password)[source]

Bases: hapcat.models.UUIDObject

__init__(id, username, email, date_of_birth, password)
__mapper__ = <Mapper at 0x7f0e27199470; User>
__mapper_args__ = {'polymorphic_identity': 'user'}
__module__ = 'hapcat.models'
__table__ = Table('user', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<user>, primary_key=True, nullable=False), Column('username', UnicodeText(), table=<user>, nullable=False), Column('email', EmailType(length=255), table=<user>, nullable=False), Column('date_of_birth', Date(), table=<user>, nullable=False), Column('password', PasswordType(length=4294967331), table=<user>, nullable=False), schema=None)
__tablename__ = 'user'
_sa_class_manager = <ClassManager of <class 'hapcat.models.User'> at 7f0e2719d728>
static checkpwstrength(password, username, email, minscore=3)[source]

Check the user’s password strength.

date_of_birth
email
id
password
type
username
votes

A descriptor that presents a read/write view of an object attribute.

class hapcat.models.Votable(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e27171160; Votable>
__mapper_args__ = {'polymorphic_identity': 'votable'}
__module__ = 'hapcat.models'
__table__ = Table('votable', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<votable>, primary_key=True, nullable=False), Column('name', UnicodeText(), table=<votable>, nullable=False), schema=None)
__tablename__ = 'votable'
_sa_class_manager = <ClassManager of <class 'hapcat.models.Votable'> at 7f0e27167db8>
id
name
photos

A descriptor that presents a read/write view of an object attribute.

tags

A descriptor that presents a read/write view of an object attribute.

type
class hapcat.models.VotablePhoto(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e27183d30; VotablePhoto>
__module__ = 'hapcat.models'
__table__ = Table('votable_photo', MetaData(bind=None), Column('votable_id', UUIDType(length=16), ForeignKey('votable.id'), table=<votable_photo>, primary_key=True, nullable=False), Column('photo_id', UUIDType(length=16), ForeignKey('photo.id'), table=<votable_photo>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'votable_photo'
_sa_class_manager = <ClassManager of <class 'hapcat.models.VotablePhoto'> at 7f0e2718ed68>
photo
photo_id
votable
votable_id
class hapcat.models.VotableTag(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e27171ba8; VotableTag>
__module__ = 'hapcat.models'
__table__ = Table('votable_tag', MetaData(bind=None), Column('votable_id', UUIDType(length=16), ForeignKey('votable.id'), table=<votable_tag>, primary_key=True, nullable=False), Column('tag_id', UUIDType(length=16), ForeignKey('tag.id'), table=<votable_tag>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'votable_tag'
_sa_class_manager = <ClassManager of <class 'hapcat.models.VotableTag'> at 7f0e2717b8b8>
tag
tag_id
votable
votable_id
class hapcat.models.Vote(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7f0e27199b38; Vote>
__module__ = 'hapcat.models'
__table__ = Table('vote', MetaData(bind=None), Column('votable_id', UUIDType(length=16), ForeignKey('votable.id'), table=<vote>, primary_key=True, nullable=False), Column('user_id', UUIDType(length=16), ForeignKey('user.id'), table=<vote>, primary_key=True, nullable=False), Column('numvotes', Integer(), table=<vote>, nullable=False, default=ColumnDefault(0)), schema=None)
__tablename__ = 'vote'
_sa_class_manager = <ClassManager of <class 'hapcat.models.Vote'> at 7f0e2719dc78>
numvotes
user
user_id
votable
votable_id