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

Weird compatibility issue with django-autocomplete-light #73

Open
andreynovikov opened this issue Apr 28, 2018 · 0 comments
Open

Weird compatibility issue with django-autocomplete-light #73

andreynovikov opened this issue Apr 28, 2018 · 0 comments

Comments

@andreynovikov
Copy link
Contributor

I have a weird compatibility issue with django-autocomplete-light. When I try to mass edit the following model Select button does nothing. Completely nothing. No messages, no errors in javascript console, nothing. I even tried to debug javascript code but it looks like submit action is never called. When I remove autocomplete_light.modelform_factory it starts working as intended. Weird is that I have another model which uses autocomplete_light form and it works nicely with mass edit.

Model:

class ProductRelation(models.Model):
    KIND_SIMILAR = 1
    KIND_ACCESSORY = 2
    KIND_GIFT = 3
    RELATIONSHIP_KINDS = (
        (KIND_SIMILAR, 'similar'),
        (KIND_ACCESSORY, 'accessory'),
        (KIND_GIFT, 'gift'),
        )
    parent_product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='parent_products')
    child_product = models.ForeignKey(Product, on_delete=models.CASCADE, related_name='child_products')
    kind = models.SmallIntegerField(choices=RELATIONSHIP_KINDS, default=KIND_SIMILAR, db_index=True)

Admin:

@admin.register(ProductRelation)
class ProductRelationAdmin(admin.ModelAdmin):
    list_display = ['parent_product', 'child_product', 'kind']
    list_display_links = ['parent_product', 'child_product']
    form = autocomplete_light.modelform_factory(ProductRelation, exclude=['fake'])
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