{"action":"opened","issue":{"url":"https://api.github.com/repos/mlavin/django-selectable/issues/150","labels_url":"https://api.github.com/repos/mlavin/django-selectable/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/mlavin/django-selectable/issues/150/comments","events_url":"https://api.github.com/repos/mlavin/django-selectable/issues/150/events","html_url":"https://github.com/mlavin/django-selectable/issues/150","id":91576725,"number":150,"title":"Enhance selectable to make use of Django models.Manager","user":{"login":"gamesbook","id":354027,"avatar_url":"https://avatars.githubusercontent.com/u/354027?v=3","gravatar_id":"","url":"https://api.github.com/users/gamesbook","html_url":"https://github.com/gamesbook","followers_url":"https://api.github.com/users/gamesbook/followers","following_url":"https://api.github.com/users/gamesbook/following{/other_user}","gists_url":"https://api.github.com/users/gamesbook/gists{/gist_id}","starred_url":"https://api.github.com/users/gamesbook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamesbook/subscriptions","organizations_url":"https://api.github.com/users/gamesbook/orgs","repos_url":"https://api.github.com/users/gamesbook/repos","events_url":"https://api.github.com/users/gamesbook/events{/privacy}","received_events_url":"https://api.github.com/users/gamesbook/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-28T09:28:31Z","updated_at":"2015-06-28T09:28:31Z","closed_at":null,"body":"It would be really useful to allow lookups based on Models to make use of the filters that have already been defined for a model via the model manager.  \r\n\r\nThe syntax could be simple, and the functionality would work in a similar way to how filters operate now.  The advantage would be a DRY approach; in many cases, the filters are trying emulate criteria already defined and tested elsewhere.\r\n\r\nA concrete example is shown here, based on  the model shown in  https://docs.djangoproject.com/en/1.8/topics/db/managers/#modifying-initial-manager-querysets and the example in http://django-selectable.readthedocs.org/en/latest/lookups.html#user-lookup-example\r\n\r\n```\r\nfrom mylibrary.models import Book, DahlBookManager\r\n\r\nfrom selectable.base import ModelLookup\r\nfrom selectable.registry import registry\r\n\r\n\r\nclass DahlBookLookup(ModelLookup):\r\n    model = Book\r\n    search_fields = (\r\n        'title__icontains',\r\n        'author__icontains'\r\n    )\r\n    manager = DahlBookManager\r\n```"}}