Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Jan 21, 2024
1 parent b61a1ee commit a7078c5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions aiohttp_admin/backends/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,13 @@ def __init__(self, db: AsyncEngine, model_or_table: _ModelOrTable):
if cn.contains_column(c))
key = next(iter(c.foreign_keys))
label = c.name.replace("_", " ").title()
field_props: dict[str, Any] = {"reference": key.column.table.name,
"target": key.column.name,
"source": fk(*constraint.column_keys),
"label": label}
inp_props = field_props.copy()
field_props: dict[str, Any] = {}
inp_props: dict[str, Any] = {"referenceKeys": keys}
keys = tuple((col.name, next(iter(col.foreign_keys)).column.name)
for col in constraint.columns)
inp_props.update({"label": label, "referenceKeys": keys})
props: dict[str, Any] = {}
props: dict[str, Any] = {"reference": key.column.table.name,
"target": key.column.name, "label": label,
"source": fk(*constraint.column_keys)}
else:
field, inp, field_props, inp_props = get_components(c.type)
props = {"source": data(c.name)}
Expand Down

0 comments on commit a7078c5

Please sign in to comment.