Django-autocomplete-light does not work

Let’s go through the checklist found in the official docs and try a few other things.

Initial check list

  • While coping widgets from other form you changed the names. Right model, right field, right url.
  • Your url must be reversable. Run shell in the Django console and then django.urls.reverse('your_url_name') – it must return something.
  • You use ModelSelect2Multiple for ManyToManyField() and ModelSelect2 for ForeignKey()

Initial check list

  • Your ManyToManyField() should not have a through table. There is no point in that at all.
  • Your ManyToManyField() in admin should not be altered by being included in filter_horizontal. See the difference on the pictures (the first is without the field being included in filter_horizontal and the second is with)
  • Don’t forget to set form = YourForm in ModelAdmin inherited class for your model.
  • In case you decided to alter the project’s urls, if you have separate ones for development and production, don’t forget to keep that in line 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.