From 431978e6267d86e2743dbeb7d31d54aa04fd0b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Sat, 3 Aug 2024 13:03:09 +0200 Subject: [PATCH] =?UTF-8?q?Star=C3=BD=20kus=20k=C3=B3du,=20kter=C3=BD=20by?= =?UTF-8?q?=20se=20mohl=20hodit,=20ale=20je=20p=C5=99=C3=AD=C5=A1ern=C4=9B?= =?UTF-8?q?=20zastaral=C3=BD=20(ObrazekAutocomplete)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- galerie/autocomplete_light_registry.py.old | 45 ---------------------- 1 file changed, 45 deletions(-) delete mode 100644 galerie/autocomplete_light_registry.py.old diff --git a/galerie/autocomplete_light_registry.py.old b/galerie/autocomplete_light_registry.py.old deleted file mode 100644 index 8a0c5952..00000000 --- a/galerie/autocomplete_light_registry.py.old +++ /dev/null @@ -1,45 +0,0 @@ -from autocomplete_light import shortcuts as autocomplete_light - -from .models import Obrazek, Galerie -from .views import cesta_od_korene - - -class ObrazekAutocomplete(autocomplete_light.AutocompleteModelBase): - - model = Obrazek - search_fields = ['nazev', 'popis'] - split_words = True - limit_choices = 15 - attrs = { - # This will set the input placeholder attribute: - 'placeholder': u'Obrázek', - # This will set the yourlabs.Autocomplete.minimumCharacters - # options, the naming conversion is handled by jQuery - 'data-autocomplete-minimum-characters': 1, - } - - choice_html_format = ''' - - - {} - {} - - - ''' - - def choice_label(self, obrazek): - cesta = "/".join(g.nazev for g in cesta_od_korene(obrazek.galerie)) - popis = "{}
".format(obrazek.popis) if obrazek.popis else "" - return '{}
{}{}'.format(obrazek.nazev, popis, cesta) - - def choice_html(self, obrazek): - """Vrátí kus html i s obrázkem, které se pak ukazuje v nabídce""" - return self.choice_html_format.format(self.choice_value(obrazek), - obrazek.obrazek_maly_tag(), self.choice_label(obrazek)) - - widget_attrs={ - 'data-widget-maximum-values': 15, - 'class': 'modern-style', - } - -autocomplete_light.register(ObrazekAutocomplete)