avoid registering for standalone apps

Issue #16 wontfix
Federico Maggi
created an issue

Is it possible to use (or modify) AutoCompleteWidget without having to register the choices set in the URLConf?

I am willing to put django-autocomplete as a requirement for django-academic but I don't want to ask the users to "mangle" with their URLConf.

I simply want to distribute django-academic as a standalone app with its own custom django-academic/academic/widgets.py (that contains my JQueryACWidget) and have the users to pip install django-academic.

Any idea?

Comments (3)

  1. Luke Plant

    I'm not the author, but I think I'm right in closing this. In general, you cannot expect to install Django applications with just 'pip install'. They often have lots of ways in which they need to be plugged in.

    It's difficult to know how you expect the widget to be able to get data from the server without altering the URLconf. In this case, the only alternative to manually altering the URLconf is to have autocomplete do the 'mangling' for you (i.e. monkey patching). If you can stomach that kind of monkey patching (and if it actually works), you could implement your JQueryACWidget so that it does that, but I doubt such a feature will end up in the core app.

  2. Germano Gabbianelli repo owner

    You can accomplish this by subclassing the autocomplete view and adding it to your app's urls.py, then ask your users to include your urls in their project's urlconf.

    You have to subclass the view because you should not include the default "autocomplete" view instance in your app urls. It should be added only to the project URLConf, to avoid it gets registered multiple times by different apps.

  3. Log in to comment