Skip to content
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

Attempting to set visible columns as a join on ForeignKey fails #431

Open
Skelmis opened this issue Jan 14, 2025 · 1 comment
Open

Attempting to set visible columns as a join on ForeignKey fails #431

Skelmis opened this issue Jan 14, 2025 · 1 comment

Comments

@Skelmis
Copy link
Contributor

Skelmis commented Jan 14, 2025

When attempting to set visible columns to a join column on a ForeignKey column the entire table UI will fail to display data as the admin UI doesn't know how to handle it.

Code:

class Manager(Table):
    name = Text()

class Band(Table):
    manager = ForeignKey(references=Manager)

TableConfig(Band, visible_columns[Band.id, Band.manager.name])

Resulting schema:

{"extra":{"visible_column_names": ["id", "name"]},...}

Therefore the client attempts to look for Band.name, which results in it failing.

I believe this to be because it's simply not a supported feature (ForeignKey joins in table configs), but raising it none the less so I can document it

@Skelmis
Copy link
Contributor Author

Skelmis commented Jan 14, 2025

Assuming Manager.name is unique, and the user is happy with the implied associated this can be kinda solved with Manager.get_readable using Manager.name as the representation. Still not ideal for if the user wants more visible columns however

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant