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

Grappelli autocomplete field in nested inline got initialized twice if parent inline has autocomplete field with same name #57

Closed
joseph2002 opened this issue Sep 19, 2016 · 2 comments

Comments

@joseph2002
Copy link

As described, consider the case below:

class ChildInline(NestedStackedInline):
    fields = ('name', 'category')
    raw_id_fields = ('category',)
    autocomplete_lookup_fields = {'fk': ('category',)}

class ParentInline(NestedStackedInline):
    fields = ('name', 'category')
    inlines = (ChildInline,)
    raw_id_fields = ('category',)
    autocomplete_lookup_fields = {'fk': ('category',)}

the autocomplete field 'category' in ChildInline will be initialized twice, so that two input box will appear.
in DJNesting.initAutocompleteFields, $('#' + prefix + '-group > .djn-items > *:not(.djn-empty-form)') .find('input[name^="' + prefix + '"][name$="-' + this + '"]') will also find input in child inline with the same name.
currently, removing the 'category' field from autocomplete_loopup_fields in ChildInline seems ok.

@joseph2002
Copy link
Author

also noticed that if I add more ChildInline item, the autocomplete filed in previous sibling ChildInline got init again

@fdintino
Copy link
Member

This is fixed in the 3.0.12 release

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

2 participants