Browse Source

drobnosti do pythonu 3

export_seznamu_prednasek
Anet 6 years ago
parent
commit
ca89637c26
  1. 42
      seminar/autocomplete_light_registry.py

42
seminar/autocomplete_light_registry.py

@ -13,21 +13,21 @@ class SkolaAutocomplete(autocomplete_light.AutocompleteModelBase):
model = Skola
search_fields=['nazev', 'mesto', 'ulice']
search_fields = ['nazev', 'mesto', 'ulice']
split_words = True
limit_choices = 15
attrs={
attrs = {
# This will set the input placeholder attribute:
'placeholder': u'Škola',
'placeholder': 'Škola',
# This will set the yourlabs.Autocomplete.minimumCharacters
# options, the naming conversion is handled by jQuery
'data-autocomplete-minimum-characters': 1,
}
widget_attrs={
widget_attrs = {
'data-widget-maximum-values': 15,
'class': 'modern-style',
}
@ -39,24 +39,24 @@ class ResitelAutocomplete(autocomplete_light.AutocompleteModelBase):
model = Resitel
search_fields=['jmeno', 'prijmeni']
search_fields = ['jmeno', 'prijmeni']
split_words = False
limit_choices = 15
def choice_label(self, resitel):
return u"%s, %s (%s)" % (resitel.plne_jmeno(), resitel.mesto, resitel.rok_maturity)
return "%s, %s (%s)" % (resitel.plne_jmeno(), resitel.mesto, resitel.rok_maturity)
attrs={
attrs= {
# This will set the input placeholder attribute:
'placeholder': u'Řešitel',
'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={
widget_attrs = {
'data-widget-maximum-values': 15,
# Enable modern-style widget !
'class': 'modern-style',
@ -68,26 +68,26 @@ class OrganizatorAutocomplete(autocomplete_light.AutocompleteModelBase):
model = Organizator
search_fields=['user__first_name', 'user__last_name', 'prezdivka']
search_fields = ['user__first_name', 'user__last_name', 'prezdivka']
split_words = False
limit_choices = 15
def choice_label(self, organizator):
return u"%s '%s' %s" % (organizator.user.first_name,
return "%s '%s' %s" % (organizator.user.first_name,
organizator.prezdivka,
organizator.user.last_name)
attrs={
attrs = {
# This will set the input placeholder attribute:
'placeholder': u'Organizátor',
'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={
widget_attrs = {
'data-widget-maximum-values': 15,
# Enable modern-style widget !
'class': 'modern-style',
@ -101,7 +101,7 @@ class ProblemAutocomplete(autocomplete_light.AutocompleteModelBase):
model = Problem
search_fields=['nazev']
search_fields = ['nazev']
split_words = False
@ -111,23 +111,23 @@ class ProblemAutocomplete(autocomplete_light.AutocompleteModelBase):
if p.stav == Problem.STAV_ZADANY:
popisek = ""
try:
popisek = u"%s (%s, %s.%s)" % (p.nazev, p.typ, p.cislo_zadani.rocnik.rocnik, p.kod_v_rocniku())
popisek = "%s (%s, %s.%s)".format(p.nazev, p.typ, p.cislo_zadani.rocnik.rocnik, p.kod_v_rocniku())
except:
#popisek = u"%s (%s, %s.%s)" % (p.nazev, p.typ, p.stav)
#popisek = "%s (%s, %s.%s)".format(p.nazev, p.typ, p.stav)
popisek = "CHYBA"
return popisek
else:
return u"%s (%s, %s)" % (p.nazev, p.typ, p.stav)
return "%s (%s, %s)".format(p.nazev, p.typ, p.stav)
attrs={
attrs = {
# This will set the input placeholder attribute:
'placeholder': u'Problém',
'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={
widget_attrs = {
'data-widget-maximum-values': 10,
# Enable modern-style widget !
'class': 'modern-style',

Loading…
Cancel
Save