diff --git a/src/wuttjamaican/db/model/auth.py b/src/wuttjamaican/db/model/auth.py index 59fc900..9a5ab3b 100644 --- a/src/wuttjamaican/db/model/auth.py +++ b/src/wuttjamaican/db/model/auth.py @@ -44,7 +44,7 @@ from sqlalchemy import orm from sqlalchemy.ext.associationproxy import association_proxy from wuttjamaican.db.util import uuid_column, uuid_fk_column -from wuttjamaican.db.model.base import Base +from wuttjamaican.db.model.base import Base, Person from wuttjamaican.util import make_utc @@ -204,8 +204,6 @@ class User(Base): # pylint: disable=too-few-public-methods person_uuid = uuid_fk_column("person.uuid", nullable=True) person = orm.relationship( "Person", - # TODO: seems like this is not needed? - # uselist=False, back_populates="users", cascade_backrefs=False, doc=""" @@ -214,6 +212,21 @@ class User(Base): # pylint: disable=too-few-public-methods """, ) + # TODO: these may or may not be good ideas? i added them mostly + # for sake of testing association proxy behavior in wuttaweb, b/c + # i was lazy and didn't want to write proper fixtures. so if + # they are a problem then doing that should fix it.. + first_name = association_proxy( + "person", + "first_name", + creator=lambda n: Person(first_name=n, full_name=n), + ) + last_name = association_proxy( + "person", + "last_name", + creator=lambda n: Person(last_name=n, full_name=n), + ) + active = sa.Column( sa.Boolean(), nullable=False,