django-autocompletefilter
=========================
A django application that lets you use the built in autocomplete function of the
django admin to filter in admin list views by foreign key relations.
.. image:: https://pbs.twimg.com/media/DgmzYLbW4AA9oL3.jpg:large
Usage
-----
#. Install the package, for example from PyPi::
pip install django-autocompletefilter
#. Add ``autocompletefilter`` to your ``INSTALLED_APPS`` setting.
#. Create and register a model admin for the model you want to filter by.
Ensure it has ``search_fields`` specified for autocomplete to work.
#. In your second model admin, use the ``AutocompleteFilterMixin`` on your class and
add the desired foreign key attribute to filter by to the ``list_filter``
items by using the AutocompleteListFilter class::
from autocompletefilter.admin import AutocompleteFilterMixin
from autocompletefilter.filters import AutocompleteListFilter
class FooAdmin(AutocompleteFilterMixin, admin.ModelAdmin):
list_filter = (
('bar', AutocompleteListFilter),
)
Status of this project
----------------------
This project is currently using a rather hacky way to implement this.
Caution is advised when using it.
Using multiple autocomplete filters on the same page does work.
Currently only tested on Python 3.6
Contributing
------------
All suggestions are welcome. Especially about ways to make this cleaner.
Common issues
-------------
- **Reverse for '<app_name>_<model_name>_autocomplete' not found.**
You must register a model admin with ``search_fields`` for the model you want to look up.
- **The results could not be loaded.**
You likely forgot to specify ``search_fields`` on your model admin for the model you want to look up.
Raw data
{
"_id": null,
"home_page": "https://github.com/julianwachholz/django-autocompletefilter",
"name": "django-autocompletefilter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.4",
"maintainer_email": null,
"keywords": "django django-admin autocomplete auto-complete filter select2",
"author": "Julian Wachholz",
"author_email": "julian@wachholz.ch",
"download_url": "https://files.pythonhosted.org/packages/2b/10/3775f2e14a5c10261898491855cb09046012ba49e63e7fa0783f4135371a/django_autocompletefilter-0.0.9.tar.gz",
"platform": null,
"description": "django-autocompletefilter\n=========================\n\nA django application that lets you use the built in autocomplete function of the\ndjango admin to filter in admin list views by foreign key relations.\n\n.. image:: https://pbs.twimg.com/media/DgmzYLbW4AA9oL3.jpg:large\n\nUsage\n-----\n\n#. Install the package, for example from PyPi::\n\n pip install django-autocompletefilter\n\n#. Add ``autocompletefilter`` to your ``INSTALLED_APPS`` setting.\n\n#. Create and register a model admin for the model you want to filter by.\n Ensure it has ``search_fields`` specified for autocomplete to work.\n\n#. In your second model admin, use the ``AutocompleteFilterMixin`` on your class and\n add the desired foreign key attribute to filter by to the ``list_filter``\n items by using the AutocompleteListFilter class::\n\n from autocompletefilter.admin import AutocompleteFilterMixin\n from autocompletefilter.filters import AutocompleteListFilter\n\n class FooAdmin(AutocompleteFilterMixin, admin.ModelAdmin):\n list_filter = (\n ('bar', AutocompleteListFilter),\n )\n\n\nStatus of this project\n----------------------\n\nThis project is currently using a rather hacky way to implement this.\nCaution is advised when using it.\n\nUsing multiple autocomplete filters on the same page does work.\n\nCurrently only tested on Python 3.6\n\n\nContributing\n------------\n\nAll suggestions are welcome. Especially about ways to make this cleaner.\n\n\nCommon issues\n-------------\n\n- **Reverse for '<app_name>_<model_name>_autocomplete' not found.**\n\n You must register a model admin with ``search_fields`` for the model you want to look up.\n\n- **The results could not be loaded.**\n\n You likely forgot to specify ``search_fields`` on your model admin for the model you want to look up.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django ModelAdmin list_filter with autocomplete widget.",
"version": "0.0.9",
"project_urls": {
"Homepage": "https://github.com/julianwachholz/django-autocompletefilter"
},
"split_keywords": [
"django",
"django-admin",
"autocomplete",
"auto-complete",
"filter",
"select2"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e946ccd6c2672321c17bee9a72b7907d646b26b9de825e6460fdb2547171be89",
"md5": "2348960a1ac5b88d922c5fb8be762e95",
"sha256": "2225053538a3621260016c228d439aa5fcf37eacc8c17a7de9bed85393a255b3"
},
"downloads": -1,
"filename": "django_autocompletefilter-0.0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2348960a1ac5b88d922c5fb8be762e95",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.4",
"size": 6265,
"upload_time": "2024-09-23T11:54:29",
"upload_time_iso_8601": "2024-09-23T11:54:29.110392Z",
"url": "https://files.pythonhosted.org/packages/e9/46/ccd6c2672321c17bee9a72b7907d646b26b9de825e6460fdb2547171be89/django_autocompletefilter-0.0.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2b103775f2e14a5c10261898491855cb09046012ba49e63e7fa0783f4135371a",
"md5": "644464136c2a326f5e4122c9351536a9",
"sha256": "d1d43c2c5cabcf0b657ab03dcde6773ad1bb045dec6ea90164394b5198e7ff5c"
},
"downloads": -1,
"filename": "django_autocompletefilter-0.0.9.tar.gz",
"has_sig": false,
"md5_digest": "644464136c2a326f5e4122c9351536a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.4",
"size": 5663,
"upload_time": "2024-09-23T11:54:29",
"upload_time_iso_8601": "2024-09-23T11:54:29.975230Z",
"url": "https://files.pythonhosted.org/packages/2b/10/3775f2e14a5c10261898491855cb09046012ba49e63e7fa0783f4135371a/django_autocompletefilter-0.0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-23 11:54:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "julianwachholz",
"github_project": "django-autocompletefilter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-autocompletefilter"
}