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

Piccolo-Admin incorrectly registers ForeignKey references as Tables #361

Open
aabmets opened this issue Feb 20, 2024 · 0 comments
Open

Piccolo-Admin incorrectly registers ForeignKey references as Tables #361

aabmets opened this issue Feb 20, 2024 · 0 comments

Comments

@aabmets
Copy link

aabmets commented Feb 20, 2024

Given the following table definitions:

class ElementsTable(Table, tablename="meta_elements", schema=AppConfig.DB_SCHEMA):
    classification_code = ForeignKey(
        references=ClassificationsTable,
        target_column=ClassificationsTable.code,
        on_delete=OnDelete.cascade,
        on_update=OnUpdate.cascade,
        required=True,
        null=False
    )
    
class ClassificationsTable(Table, tablename="meta_classifications", schema=AppConfig.DB_SCHEMA):
    ...
    
# other tables omitted due to irrelevance

Piccolo-admin produces the following output in the web GUI:
image

You can witness the double "Meta Classifications" table in the tables list.
I have verified, that when the ForeignKey column type is replaced with any other column type (Varchar, Integer, etc.),
a duplicate entry is not introduced into the tables list of the admin web GUI.

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