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:
parent
4643aa3e3c
commit
1efaca4e52
|
@ -462,12 +462,11 @@ def get_model_fields(config, model_class=None):
|
|||
if not model_class:
|
||||
return
|
||||
|
||||
app = config.get_app()
|
||||
model = app.model
|
||||
if not issubclass(model_class, model.Base):
|
||||
return
|
||||
|
||||
try:
|
||||
mapper = sa.inspect(model_class)
|
||||
except sa.exc.NoInspectionAvailable:
|
||||
pass
|
||||
else:
|
||||
fields = [prop.key for prop in mapper.iterate_properties]
|
||||
return fields
|
||||
|
||||
|
|
Loading…
Reference in a new issue