1
0
Fork 0

fix: make util.get_model_fields() work with more model classes

should not restrict to classes inheriting from wuttjamaican base, any
sqlalchemy class should work
This commit is contained in:
Lance Edgar 2024-08-19 11:48:52 -05:00
parent 4643aa3e3c
commit 1efaca4e52

View file

@ -462,12 +462,11 @@ def get_model_fields(config, model_class=None):
if not model_class: if not model_class:
return return
app = config.get_app() try:
model = app.model
if not issubclass(model_class, model.Base):
return
mapper = sa.inspect(model_class) mapper = sa.inspect(model_class)
except sa.exc.NoInspectionAvailable:
pass
else:
fields = [prop.key for prop in mapper.iterate_properties] fields = [prop.key for prop in mapper.iterate_properties]
return fields return fields