From 7954d6d59f25c3905745efa3089f7b8944ca30e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 1 Nov 2021 23:50:41 +0100 Subject: [PATCH] =?UTF-8?q?Delete=20star=C3=BD=20autocomplete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/autocomplete_light_registry.py.old | 139 --------------------- 1 file changed, 139 deletions(-) delete mode 100644 seminar/autocomplete_light_registry.py.old diff --git a/seminar/autocomplete_light_registry.py.old b/seminar/autocomplete_light_registry.py.old deleted file mode 100644 index 64590adf..00000000 --- a/seminar/autocomplete_light_registry.py.old +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- - -from autocomplete_light import shortcuts as autocomplete_light - -from .models import Skola, Resitel, Problem, Organizator -from taggit.models import Tag - - -autocomplete_light.register(Tag) - - -class SkolaAutocomplete(autocomplete_light.AutocompleteModelBase): - - model = Skola - - search_fields = ['nazev', 'mesto', 'ulice'] - - split_words = True - - limit_choices = 15 - - attrs = { - # This will set the input placeholder attribute: - 'placeholder': 'Škola', - # This will set the yourlabs.Autocomplete.minimumCharacters - # options, the naming conversion is handled by jQuery - 'data-autocomplete-minimum-characters': 1, - } - - widget_attrs = { - 'data-widget-maximum-values': 15, - 'class': 'modern-style', - } - -autocomplete_light.register(SkolaAutocomplete) - - -class ResitelAutocomplete(autocomplete_light.AutocompleteModelBase): - - model = Resitel - - search_fields = ['jmeno', 'prijmeni'] - - split_words = False - - limit_choices = 15 - - def choice_label(self, resitel): - return "%s, %s (%s)" % (resitel.plne_jmeno(), resitel.mesto, resitel.rok_maturity) - - attrs= { - # This will set the input placeholder attribute: - 'placeholder': 'Řešitel', - # This will set the yourlabs.Autocomplete.minimumCharacters - # options, the naming conversion is handled by jQuery - 'data-autocomplete-minimum-characters': 1, - } - - widget_attrs = { - 'data-widget-maximum-values': 15, - # Enable modern-style widget ! - 'class': 'modern-style', - } - -autocomplete_light.register(ResitelAutocomplete) - -class OrganizatorAutocomplete(autocomplete_light.AutocompleteModelBase): - - model = Organizator - - search_fields = ['user__first_name', 'user__last_name', 'prezdivka'] - - split_words = False - - limit_choices = 15 - - def choice_label(self, organizator): - return "%s '%s' %s" % (organizator.user.first_name, - organizator.prezdivka, - organizator.user.last_name) - - attrs = { - # This will set the input placeholder attribute: - 'placeholder': 'Organizátor', - # This will set the yourlabs.Autocomplete.minimumCharacters - # options, the naming conversion is handled by jQuery - 'data-autocomplete-minimum-characters': 1, - } - - widget_attrs = { - 'data-widget-maximum-values': 15, - # Enable modern-style widget ! - 'class': 'modern-style', - } - -autocomplete_light.register(OrganizatorAutocomplete) - - - -class ProblemAutocomplete(autocomplete_light.AutocompleteModelBase): - - model = Problem - - search_fields = ['nazev'] - - split_words = False - - limit_choices = 10 - - def choice_label(self, p): - if p.stav == Problem.STAV_ZADANY: - popisek = "" - try: - popisek = "%s (%s, %s.%s)".format(p.nazev, p.typ, p.cislo_zadani.rocnik.rocnik, p.kod_v_rocniku()) - except: - #popisek = "%s (%s, %s.%s)".format(p.nazev, p.typ, p.stav) - popisek = "CHYBA" - return popisek - else: - return "%s (%s, %s)".format(p.nazev, p.typ, p.stav) - - attrs = { - # This will set the input placeholder attribute: - 'placeholder': 'Problém', - # This will set the yourlabs.Autocomplete.minimumCharacters - # options, the naming conversion is handled by jQuery - 'data-autocomplete-minimum-characters': 1, - } - - widget_attrs = { - 'data-widget-maximum-values': 10, - # Enable modern-style widget ! - 'class': 'modern-style', - } - -#FIXME Nefunguje, nevime proc -#autocomplete_light.register(ProblemAutocomplete) - -