Autocomplete refactoring

* refactors konova/autocompletes.py by splitting into individual files and moving them to fitting apps
     * autocomplete files now live in APPNAME/autocomplete/...
This commit is contained in:
2022-08-18 11:25:06 +02:00
parent 4b3a35c30e
commit d785285805
33 changed files with 596 additions and 465 deletions

View File

@@ -0,0 +1,24 @@
"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: ksp-servicestelle@sgdnord.rlp.de
Created on: 18.08.22
"""
from codelist.settings import CODELIST_HANDLER_ID
from codelist.autocomplete.base import KonovaCodeAutocomplete
class HandlerCodeAutocomplete(KonovaCodeAutocomplete):
"""
Due to limitations of the django dal package, we need to subclass for each code list
"""
group_by_related = "parent"
related_field_name = "long_name"
def __init__(self, *args, **kwargs):
self.c = CODELIST_HANDLER_ID
super().__init__(*args, **kwargs)
def get_result_label(self, result):
return result.long_name