Tweak ORM relationship backrefs per SA 2.0 warnings

This commit is contained in:
Lance Edgar 2023-02-21 18:15:27 -06:00
parent 87477d7cbe
commit c03119acb2
2 changed files with 19 additions and 3 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2021 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -45,6 +45,11 @@ class MailChimpList(model.Base):
date_created = sa.Column(sa.DateTime(), nullable=True)
members = orm.relationship('MailChimpListMember',
back_populates='list',
# nb. this is to satisfy SA 2.0
cascade_backrefs=False)
def __str__(self):
return self.name or ""
@ -62,7 +67,8 @@ class MailChimpListMember(model.Base):
uuid = model.uuid_column()
list_uuid = sa.Column(sa.String(length=32), nullable=False)
list = orm.relationship(MailChimpList, backref='members')
list = orm.relationship(MailChimpList,
back_populates='members')
id = sa.Column(sa.String(length=32), nullable=True)