python - Django smart select many to many field filter_horizontal/filter_vertical does not allow chaining -
hi doing project in django 1.10. project using django-smart-select chaining input in admin panel. works fine. many many fields chaining if use filter_horizontal/filter_vertical chaining not work more. there no solution in there github page. how can solve problem? there app this?
i have same problem , solved in fork library: https://github.com/jorgecorrea/django-smart-selects can see in readme version, way use in horizontal mode mi fork: models.py
from smart_selects.db_fields import chainedmanytomanyfield class publication(models.model): name = models.charfield(max_length=255) class writer(models.model): name = models.charfield(max_length=255) publications = models.manytomanyfield('publication', blank=true, null=true) class book(models.model): publication = models.foreignkey(publication) writer = chainedmanytomanyfield( writer, horizontal=true, verbose_name='writer', chained_field="publication", chained_model_field="publications", ) name = models.charfield(max_length=255)
with little change can use django horizontal mode view, not add field admin filter_horizontal change not needed: admin.py
@admin.register(book) class bookadmin(admin.modeladmin): filter_horizontal = ('writer',) # don't because changing widget.
Comments
Post a Comment