tolta una informazione pleonastica

my-submodulepoetico
Guido Longoni 2023-07-06 02:20:43 +02:00
parent 9d4b789338
commit bb6a45e560
2 changed files with 39 additions and 53 deletions

View File

@ -32,18 +32,6 @@ class DrillDownAutocompleteJsonView(AutocompleteJsonView):
to_field_name to_field_name
) = super().process_request(request) ) = super().process_request(request)
if 'drilldown' in request.GET:
try:
drilldown_enabled = int(request.GET.get('drilldown'))
except ValueError:
raise PermissionDenied from e
try:
drilldown_enabled = {1: True, 0: False}[drilldown_enabled]
except KeyError:
raise PermissionDenied from e
self.drilldown_enabled = drilldown_enabled
if drilldown_enabled:
if 'filtered_by_dict' in request.GET: if 'filtered_by_dict' in request.GET:
try: try:
filtered_by_dict = json.loads( filtered_by_dict = json.loads(
@ -79,7 +67,6 @@ class DrillDownAutocompleteJsonView(AutocompleteJsonView):
def get_queryset(self): def get_queryset(self):
"""Return queryset based on ModelAdmin.get_search_results().""" """Return queryset based on ModelAdmin.get_search_results()."""
qs = super().get_queryset() qs = super().get_queryset()
if getattr(self, 'drilldown_enabled', False):
if hasattr(self, 'filtered_by_dict'): if hasattr(self, 'filtered_by_dict'):
dd_field = self.drilldown_field dd_field = self.drilldown_field
drilldown_filter_conditions = Q(**self.drilldown_filter_data) drilldown_filter_conditions = Q(**self.drilldown_filter_data)

View File

@ -17,7 +17,6 @@
}; };
if (element.dataset.hasOwnProperty('drilldown_enabled')) { if (element.dataset.hasOwnProperty('drilldown_enabled')) {
out.drilldown = 1;
if (element.dataset.hasOwnProperty('filtered_by')) { if (element.dataset.hasOwnProperty('filtered_by')) {
const filtered_by_fields = JSON.parse(element.dataset.filtered_by) const filtered_by_fields = JSON.parse(element.dataset.filtered_by)