Skip to content

Commit

Permalink
App Datenmanagement: Bereinigungsarbeiten Code
Browse files Browse the repository at this point in the history
  • Loading branch information
gdmhrogut committed Sep 26, 2023
1 parent f23aad7 commit 5cfa3fa
Show file tree
Hide file tree
Showing 12 changed files with 650 additions and 646 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"configureMap": true,
"createFilterObject": true,
"currMap": true,
"customMapFilters": true,
"enableAddressReferenceButton": true,
"enableMapLocate": true,
"featureGeometry": true,
Expand All @@ -29,8 +30,10 @@
"keepDjangoRequiredMessages": true,
"L": true,
"martinez": true,
"objectsExtent": true,
"orangeMarker": true,
"proj4": true,
"Promise": true,
"redMarker": true,
"results": true,
"searchField": true,
Expand All @@ -42,13 +45,13 @@
"setMapExtentByBoundingBox": true,
"setMapExtentByLeafletBounds": true,
"setMarkerToAddressSearchResult": true,
"showAllMapFeatures": true,
"subsetting": true,
"toggleModal": true,
"Wkt": true
},
"ignorePatterns": [
"datenmanagement/templates/datenmanagement/form.html",
"datenmanagement/templates/datenmanagement/map.html"
"datenmanagement/templates/datenmanagement/form.html"
],
"parserOptions": {
"ecmaVersion": "latest",
Expand Down
35 changes: 4 additions & 31 deletions bemas/views/base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from datetime import date, datetime
from django.apps import apps
from django.db.models import ForeignKey, Q
from django.db.models import ForeignKey
from django.urls import reverse
from django.utils.html import escape
from django_datatables_view.base_datatable_view import BaseDatatableView
from jsonview.views import JsonView
from re import match, search, sub

from toolbox.models import Subsets
from toolbox.utils import optimize_datatable_filter
from bemas.models import Codelist, Complaint, Contact, LogEntry, Organization, Originator, Person
from bemas.utils import LOG_ACTIONS, get_foreign_key_target_model, get_foreign_key_target_object, \
get_icon_from_settings, is_bemas_admin, is_bemas_user, is_geometry_field
Expand Down Expand Up @@ -254,35 +254,8 @@ def filter_queryset(self, qs):
# foreign key target model is object class
else:
search_column += '__search_content'
case_a = search('^[0-9]{2}\\.[0-9]{2}\\.[0-9]{4}$', search_element)
case_b = search('^[0-9]{2}\\.[0-9]{4}$', search_element)
case_c = search('^[0-9]{2}\\.[0-9]{2}$', search_element)
if case_a or case_b or case_c:
search_element_splitted = search_element.split('.')
kwargs = {
'{0}__{1}'.format(search_column, 'icontains'): (search_element_splitted[
2] + '-' if case_a else '') +
search_element_splitted[1] + '-' +
search_element_splitted[0]
}
elif search_element == 'ja':
kwargs = {
'{0}__{1}'.format(search_column, 'icontains'): 'true'
}
elif search_element == 'nein' or search_element == 'nei':
kwargs = {
'{0}__{1}'.format(search_column, 'icontains'): 'false'
}
elif match(r"^[0-9]+,[0-9]+$", search_element):
kwargs = {
'{0}__{1}'.format(search_column, 'icontains'): sub(',', '.', search_element)
}
else:
kwargs = {
'{0}__{1}'.format(search_column, 'icontains'): search_element
}
q = Q(**kwargs)
qs_params_inner = qs_params_inner | q if qs_params_inner else q
qs_params_inner = optimize_datatable_filter(
search_element, search_column, qs_params_inner)
qs_params = qs_params & qs_params_inner if qs_params else qs_params_inner
qs = qs.filter(qs_params)
return qs
Expand Down
1 change: 0 additions & 1 deletion datenmanagement/admin.py

This file was deleted.

4 changes: 2 additions & 2 deletions datenmanagement/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ class BasemodelMeta:
map_deadlinefilter_fields = None
# Dictionary:
# names of those fields of this model (as keys)
# which shall appear as interval/range map filters in the map view of this model
# which shall appear as interval map filters in the map view of this model
# in exactly this order, with their respective titles (as values)
# (always processed in pairs!)
map_rangefilter_fields = None
map_intervalfilter_fields = None
# Dictionary:
# names of those fields of this model (as keys)
# which shall appear as map filters in the map view of this model
Expand Down
2 changes: 1 addition & 1 deletion datenmanagement/models/models_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ class BasemodelMeta(ComplexModel.BasemodelMeta):
'art_kontrolle': 'art'
}
map_feature_tooltip_field = 'art_kontrolle'
map_rangefilter_fields = {
map_intervalfilter_fields = {
'startzeitpunkt': 'Startzeitpunkt',
'endzeitpunkt': 'Endzeitpunkt'
}
Expand Down
Loading

0 comments on commit 5cfa3fa

Please sign in to comment.