From 589f279f04d43f3dd6e983eab9f9a50a22cc0ada Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 16 Feb 2026 18:39:09 -0600 Subject: [PATCH] fix: add assocation proxies for `User.first_name` and `User.last_name` for a rather dubious purpose though..so may need to undo this, we'll see --- src/wuttjamaican/db/model/auth.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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,