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,14 +462,13 @@ 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
|
mapper = sa.inspect(model_class)
|
||||||
if not issubclass(model_class, model.Base):
|
except sa.exc.NoInspectionAvailable:
|
||||||
return
|
pass
|
||||||
|
else:
|
||||||
mapper = sa.inspect(model_class)
|
fields = [prop.key for prop in mapper.iterate_properties]
|
||||||
fields = [prop.key for prop in mapper.iterate_properties]
|
return fields
|
||||||
return fields
|
|
||||||
|
|
||||||
|
|
||||||
def make_json_safe(value, key=None, warn=True):
|
def make_json_safe(value, key=None, warn=True):
|
||||||
|
|
Loading…
Reference in a new issue