-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ForeignKey column is not listed in view. #2345
Comments
Actually I changed sqlalchemy version to sqlalchemy==1.4.46, It works. |
I think this does indicate that Flask-Admin does not work as one would expect for SqlAlchemy>2.0 and the requirements should be pinned to indicate that or else a patch to make relationship fields work properly out of the box as you would expect. |
Have the same issue. It makes impossible using flask-admin with sqlalchemy 2.0 and it's painful! Here's the code to reproduce:
Here's requirements:
|
I made PR. |
What happens if you add the foreign key manually?
|
@ElLorans then it works properly. But manual adding for every relationship is not what we are used to while using flask admin with sqla < 2.0. |
I understand, but this workaround makes possible to use SQLAlchemy >2.0, so I thought sharing could be useful. |
@ElLorans surely. You did great, thanks! I will use it while waiting for a fix from developers not to use any workarounds for a long time |
There is an open PR here that would allow full usage of flask-admin with SQLAlchemy>2.0 - is there something blocking it from being merged? |
Is this also the reason why when using the example below and trying to tap on "Create" will give:
Or is that unrelated? |
That looks like WTForms 3.1.0 #2391. |
Oh, right thank you! 🙏
So I will need to work out a downgrade of that lib.
…On Wed 25. Oct 2023 at 21.37, Chris Mayo ***@***.***> wrote:
Is this also the reason why when using the example below and trying to tap
on "Create" will give:
ValueError: not enough values to unpack (expected 4, got 3)
Or is that unrelated?
That looks like WTForms 3.1.0 #2391
<#2391>.
—
Reply to this email directly, view it on GitHub
<#2345 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIAJ7C3M5RVHRKOXLIGEMDYBFL5JAVCNFSM6AAAAAAV55MWKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZZHA2DANJVGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I'm so glad I was able to find this issue posted. I have been stuck with this for ages. I was able to implement the workaround where I would specify the column myself but I will have many models and it wouldn't make sense to do that for each of them. I had to downgrade I hope a fix will be implemented soon. Edit: It works on the older version but the relationship from the Parent to Child is still not displaying unless you specify the column manually which apparently has been an issue for a longer time. |
from sqlalchemy 2.0.0, It seems foreign key column cannot appear in list-view, edit-view.
Flask-SQLAlchemy==3.0.3
Flask-Admin==1.6.1
sqlalchemy==2.0.6
The text was updated successfully, but these errors were encountered: