0

I am using django 1.6 admin-panel with django-suit, and I am trying to make a tabular inline that will auto-complete me with a name of a model instance. For this I use django-ajax-selects.
Now, if I define, let's say, extra = 3, then I will have 3 tabular lines bound with ajax.

And every other line I add with the 'Add another line' button won't auto-complete me (the widget is shown. Its just that the ajax is not bound to the field).

Is there a django-ajax-select option that will bind the new fields in the inline? I saw in the documentation that one of its features was 'Admin inlines', but no materialistic example of how to do it.

If django-ajax-selects does not offer a built-in way to achieve it, how can it be done with jQuery/ Javascript overriding?

Here's my inlines.py

class AlternativeInline(AjaxSelectAdminTabularInline):
    model = Alternative
    form = make_ajax_form(Alternative, {'item_compared_to': 'item'})
    fk_name = 'item_compared_with'
    suit_classes = 'suit-tab suit-tab-alternatives'
    verbose_name = 'Alternative'
    verbose_name_plural = 'Alternatives'
    extra = 1

If any other snippets from my code are required, just say so :)

Amir Tugi
  • 2,386
  • 3
  • 16
  • 18

1 Answers1

1

Well, solved this problem all by myself.
Documented it in django-ajax-selects GitHub.
Link's here.

Amir Tugi
  • 2,386
  • 3
  • 16
  • 18