Implement notification rules and settings
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
import uuid
|
||||
|
||||
# from core import r
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models import QuerySet
|
||||
@@ -490,54 +489,6 @@ class ObjectDelete(RestrictedViewMixin, ObjectNameMixin, DeleteView):
|
||||
return response
|
||||
|
||||
|
||||
class SearchDenied:
|
||||
def __init__(self, key, value):
|
||||
self.key = key
|
||||
self.value = value
|
||||
|
||||
|
||||
class LookupDenied:
|
||||
def __init__(self, key, value):
|
||||
self.key = key
|
||||
self.value = value
|
||||
|
||||
|
||||
def remove_defaults(query_params):
|
||||
for field, value in list(query_params.items()):
|
||||
if field in settings.DRILLDOWN_DEFAULT_PARAMS:
|
||||
if value == settings.DRILLDOWN_DEFAULT_PARAMS[field]:
|
||||
del query_params[field]
|
||||
|
||||
|
||||
def add_defaults(query_params):
|
||||
for field, value in settings.DRILLDOWN_DEFAULT_PARAMS.items():
|
||||
if field not in query_params:
|
||||
query_params[field] = value
|
||||
|
||||
|
||||
def dedup_list(data, check_keys):
|
||||
"""
|
||||
Remove duplicate dictionaries from list.
|
||||
"""
|
||||
seen = set()
|
||||
out = []
|
||||
|
||||
dup_count = 0
|
||||
for x in data:
|
||||
dedupeKey = tuple(x[k] for k in check_keys if k in x)
|
||||
if dedupeKey in seen:
|
||||
dup_count += 1
|
||||
continue
|
||||
if dup_count > 0:
|
||||
out.append({"type": "control", "hidden": dup_count})
|
||||
dup_count = 0
|
||||
out.append(x)
|
||||
seen.add(dedupeKey)
|
||||
if dup_count > 0:
|
||||
out.append({"type": "control", "hidden": dup_count})
|
||||
return out
|
||||
|
||||
|
||||
# from random import randint
|
||||
# from timeit import timeit
|
||||
# entries = 10000
|
||||
|
||||
Reference in New Issue
Block a user