Advertisement
Mochinov

Untitled

Feb 24th, 2022
850
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1.  
  2. class ActualEmployeeStatusSelectFilter(BaseSelectorFilter):
  3.     """Определяет логику фильтрации поля 'Статус пользователя (фактический)' для select."""
  4.  
  5.     def __init__(self, request, search_query, limit, is_exact, page):
  6.         self.search_query = search_query
  7.         self.limit = limit
  8.         self.is_exact = is_exact
  9.         self.page = page
  10.         self.field_name = 'actual_employee_status'
  11.         self.reference_book = {
  12.             self.field_name: PersonnelAccounting.BASE_REFERENCE_BOOKS.get(self.field_name),
  13.         }
  14.         # if not self.search_query[0]:
  15.         #     get_or_create_reference_books(self.reference_book)
  16.         super().__init__(request)
  17.  
  18.     def get_initial_items(self):
  19.         return get_queryset_for_field_with_reference_book(
  20.             reference_books=self.reference_book,
  21.             field_name=self.field_name,
  22.             queryset=RecordInReferenceBook.objects.all(),
  23.         )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement