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

Error with ForeignKey fields position #9

Open
Nielssie opened this issue Apr 1, 2020 · 4 comments
Open

Error with ForeignKey fields position #9

Nielssie opened this issue Apr 1, 2020 · 4 comments
Labels
Q&A Questions and answers

Comments

@Nielssie
Copy link

Nielssie commented Apr 1, 2020

The position of the foreignkey field in the fields tuple is not flexible.
current situation (in the example) only works with the first foreignkey field on the t position.
This works:

    fields = (
        'id',
        'title',
        'director', <-- FK
        'country', <-- FK
        'parents_guide',
        'imdb_rating',
        'genre',
        'imdb_link',
    )

This gives a javascript error:

    fields = (
        'id',
        'title',
        'imdb_rating',
        'director', <-- FK
        'country', <-- FK
        'parents_guide',
       'genre',
        'imdb_link',
    )
This gives also a javascript error:
    fields = (
        'id',
        'title',
        'director', #<-- FK
        'imdb_rating',
        'country', #<--FK
        'parents_guide',
        'imdb_rating',
        'genre',
        'imdb_link',
    )

This gives a form validation error:

    fields = (
        'id',
        'director',
        'country',
        'title',
        'imdb_rating',
        'parents_guide',
        'imdb_rating',
        'genre',
        'imdb_link',
    )
@mailtodaman
Copy link

mailtodaman commented Apr 7, 2020

I have same problem. Please let me know if you have any solution.

@trco trco added the Q&A Questions and answers label Apr 7, 2020
@trco
Copy link
Owner

trco commented Apr 7, 2020

@Nielssie @mailtodaman Unfortunately I don't have time to work on this package. It could take me a month or two to get back on track here. If any of you wants to collaborate on it, I'll definitely consider potential PRs.

@Nielssie
Copy link
Author

Nielssie commented Apr 8, 2020

@trco No worries.
I have a (dirty) workaround:
I build up the javascript variable columns in django:
var columns = {{ columns|handsomtable|safe }}
and the validation error is a javascript error in the switch function in case of a select, it was:

var index = fieldType[j][1].indexOf(value);
value = fieldType[j][0][index];

it should be:

var index = fieldType[1][1].indexOf(value_index);
 value = fieldType[1][0][index];

@mailtodaman
Copy link

Thanks for your reply. I tried it without any success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Q&A Questions and answers
Projects
None yet
Development

No branches or pull requests

3 participants