django-funky-sheets icon indicating copy to clipboard operation
django-funky-sheets copied to clipboard

Error with ForeignKey fields position

Open Nielssie opened this issue 4 years ago • 4 comments

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',
    )

Nielssie avatar Apr 01 '20 19:04 Nielssie

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

mailtodaman avatar Apr 07 '20 12:04 mailtodaman

@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.

trco avatar Apr 07 '20 16:04 trco

@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];

Nielssie avatar Apr 08 '20 13:04 Nielssie

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

mailtodaman avatar Apr 09 '20 19:04 mailtodaman