Skip to content

Instantly share code, notes, and snippets.

@daimon99
Created August 3, 2021 04:12
Show Gist options
  • Save daimon99/a444a7bca4b993367a9f422de657f90c to your computer and use it in GitHub Desktop.
Save daimon99/a444a7bca4b993367a9f422de657f90c to your computer and use it in GitHub Desktop.
#django #admin #filter
list_filter = [
('id', RangeNumericFilter),
AutocompleteFilterFactory('摄像头', 'cam_algo__cam'),
AutocompleteFilterFactory('算法', 'cam_algo__algo'),
AutocompleteFilterFactory('通道加载算法', 'cam_algo'),
'source_type',
('created', DateRangeFilter),
]
class OuFilter(AutocompleteFilter):
title = '组织' # display title
field_name = 'ou' # name of the foreign key field
list_filter = [OuFilter, UserFilter]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment