-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: relationship object not available in EDIT template but available in DETAIL template #534
Comments
In EDIT mode, obj["client"] is a STRING !!!!! I tried Obviously |
I could really use some help on this one. Any tips on how to move forward? One difference between the DETAIL and the EDIT screens/HTMLs is that in EDIT mode my relationship entity (Client) is displayed in a drop-down, whereas in the DETAIL screen it is a "clickable blue button". Maybe this causes side-effects in the "obj" object in jinja2? |
The edit template only uses the value of the primary key starlette-admin/starlette_admin/views.py Line 722 in 7465db9
You can use the starlette-admin/starlette_admin/base.py Line 458 in 7465db9
Here's an example: https://github.com/jowilf/starlette-admin-demo/blob/a1bc5d09dd6a11ecb17a6a834031c1ad4cc6561c/templates/admin/sqla/post_detail.html#L81 |
|
Describe the bug
I overrode both the DETAIL template and the EDIT template of my object/table (let's call it Foo). It has a relationship to another object/table, named Client:
This Client object has a field/column, vhost, which is a String.
I have this snippet in my temple for both EDIT and DETAIL:
Then I am looking at my entity, the value is populated. When I am editing, I get an empty string.
What I SUSPECT: in EDIT mode the relationships are fetched in a lazy fashion, perhaps? I need to force the loading, perhaps? How?
To Reproduce
Well, in any of your objects/entities/tables, override EDIT and DETAIL templates and print a property of a related entity.
Environment (please complete the following information):
Starlette-Admin version: 0.13.1
ORM/ODMs: SQLAlchemy, psycopg2-binary==2.9.9
SQLAlchemy-serializer==1.4.1
Additional context
The text was updated successfully, but these errors were encountered: