Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
[YC-1206] fix error on ftsearch (#1004)
Browse files Browse the repository at this point in the history
* fix error on ftsearch

* adress review comments

* typo
  • Loading branch information
monodo authored May 28, 2024
1 parent e554f4d commit 1d3405c
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions geocity/apps/submissions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ class ComplementaryDocumentTypeAdmin(IntegratorFilterMixin, admin.ModelAdmin):
ComplementaryDocumentTypeInline,
]
form = ComplementaryDocumentTypeAdminForm
fields = ["name", "form", "integrator"]
fields = [
"name",
"form",
"integrator",
]

def get_list_display(self, request):
if request.user.is_superuser:
Expand All @@ -258,29 +262,39 @@ def get_list_display(self, request):
return list_display

# Fields used in search_fields and list_filter
integrator_fields = [
superuser_search_fields = [
"name",
"form__name",
"integrator__name",
]
integrator_search_fields = [
"name",
"form__name",
]

superuser_list_search_fields = [
"name",
"form",
"integrator",
"form__administrative_entities",
]
user_fields = [

integrator_list_search_fields = [
"name",
"form",
]

def get_search_fields(self, request):
if request.user.is_superuser:
search_fields = self.integrator_fields
search_fields = self.superuser_search_fields
else:
search_fields = self.user_fields
search_fields = self.integrator_search_fields
return search_fields

def get_list_filter(self, request):
if request.user.is_superuser:
list_filter = self.integrator_fields
list_filter = self.superuser_list_search_fields
else:
list_filter = self.user_fields
list_filter = self.integrator_list_search_fields
return list_filter

# List types of documents
Expand Down

0 comments on commit 1d3405c

Please sign in to comment.