diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-01-14 23:05:05 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:23 +0100 | 
| commit | ce991c43e48660407003ad06910dab60b9724f5c (patch) | |
| tree | b0f33396d802d22b30fc2c73f5605d42be07d419 /ishtar_common | |
| parent | 34226e5d71ad92a669af92e09019d41b8add8c3f (diff) | |
| download | Ishtar-ce991c43e48660407003ad06910dab60b9724f5c.tar.bz2 Ishtar-ce991c43e48660407003ad06910dab60b9724f5c.zip  | |
Fix "today" search
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/views_item.py | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index ded93212b..636ad26f0 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -753,7 +753,7 @@ def _manage_many_counted_fields(fields, reversed_fields, dct, excluded_dct):              dct[k] = None -today_lbl = pgettext_lazy("key for text search", u"today"), +today_lbl = pgettext_lazy("key for text search", "today")  TODAYS = ['today']  for language_code, language_lbl in settings.LANGUAGES: @@ -778,14 +778,14 @@ def _manage_dated_fields(dated_fields, dct):              if value.startswith(today):                  base_date = datetime.date.today()                  value = value[len(today):].replace(' ', '') -                if value and value[0] in (u"-", u"+"): +                if value and value[0] in ("-", "+"):                      sign = value[0]                      try:                          days = int(value[1:])                      except ValueError:                          days = 0                      if days: -                        if sign == u"-": +                        if sign == "-":                              base_date = base_date - datetime.timedelta(                                  days=days)                          else: @@ -813,10 +813,10 @@ def _manage_dated_fields(dated_fields, dct):  def _clean_type_val(val):      for prefix in GeneralType.PREFIX_CODES: -        val = val.replace(prefix, u"") +        val = val.replace(prefix, "")      val = val.strip() -    if val.startswith(u'"') and val.endswith(u'"'): -        val = u'"{}"'.format(val[1:-1].strip()) +    if val.startswith('"') and val.endswith('"'): +        val = '"{}"'.format(val[1:-1].strip())      return val  | 
