{"id":17172898,"url":"https://github.com/20tab/twentytab-choicesfilter","last_synced_at":"2025-03-24T20:22:50.325Z","repository":{"id":16634587,"uuid":"19389763","full_name":"20tab/twentytab-choicesfilter","owner":"20tab","description":"A django app that initializes admin changelist view with select filters usin jquery-plugin select2","archived":false,"fork":false,"pushed_at":"2020-11-20T16:39:14.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T15:26:04.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/20tab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-02T21:54:42.000Z","updated_at":"2020-11-20T16:39:17.000Z","dependencies_parsed_at":"2022-08-17T21:41:02.795Z","dependency_job_id":null,"html_url":"https://github.com/20tab/twentytab-choicesfilter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Ftwentytab-choicesfilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Ftwentytab-choicesfilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Ftwentytab-choicesfilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/20tab%2Ftwentytab-choicesfilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/20tab","download_url":"https://codeload.github.com/20tab/twentytab-choicesfilter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245344441,"owners_count":20599949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T23:48:41.663Z","updated_at":"2025-03-24T20:22:50.302Z","avatar_url":"https://github.com/20tab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"twentytab-choicesfilter\n=======================\n\nA django app that initializes admin changelist view with select filters usin jquery-plugin select2\n\n## Installation\n\nUse the following command: \u003cb\u003e\u003ci\u003epip install twentytab-choicesfilter\u003c/i\u003e\u003c/b\u003e\n\n## Configuration\n\n- settings.py\n\n```py\nINSTALLED_APPS = {\n    ...,\n    'select2',\n    'choicesfilter',\n    ...\n}\n```\n\n\n- Static files\n\nRun collectstatic command or map static directory.\n\n## Usage\n\n- models.py\n\n```py\n\nclass MyModel(models.Model):\n    name = models.CharField(...)\n    related_obj = models.ForeignKey(MyRelated)\n\n```\n\n- admin.py\n\n```py\nfrom django.contrib import admin\nfrom mymodels.models import MyModel\nfrom choicesfilter.admin import ChoicesFilterAdmin\n\n\nclass MyModelAdmin(ChoicesFilterAdmin):\n    list_display = (u'name', u'related_obj')\n    choicesfilter = [u'name', 'related_obj']\n    choices_mandatory = False\n    choicesfilter_choices = {'related_obj': RelatedClass.objects.values_list('pk', 'obj_field').all()}\n\nadmin.site.register(MyModel, MyModelAdmin)\n```\n\nIf you want to initialize changelist admin view with empty queryset set 'choices_mandatory = True'\n\n** REMEMBER: choicesfilter_choices MUST be a list of binary tuples like choices for a CharField **\n\n** This app overrides {% block filters %} in change_list.html template. **\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F20tab%2Ftwentytab-choicesfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F20tab%2Ftwentytab-choicesfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F20tab%2Ftwentytab-choicesfilter/lists"}