diff options
| -rw-r--r-- | archaeological_finds/models_finds.py | 2 | ||||
| -rw-r--r-- | ishtar_common/models.py | 16 | ||||
| -rw-r--r-- | ishtar_common/models_common.py | 3 | 
3 files changed, 10 insertions, 11 deletions
| diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 6e09364ac..a9f554380 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1769,7 +1769,7 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,          if no_base_finds:              return values          # by default attach first basefind data -        if filtr and prefix + "base_finds" not in filtr: +        if not filtr or (filtr and prefix + "base_finds" not in filtr):              bf = self.get_first_base_find()              if not bf:                  return values diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 89bee27cd..bba04488b 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -196,7 +196,7 @@ class ValueGetter(object):                  val = ''              elif (key in self.GET_VALUES_EXTRA_TYPES or "type" in key) and (                    val.__class__.__name__.split('.')[0] == 'ManyRelatedManager'): -                val = u" ; ".join([str(v) for v in val.all()]) +                val = " ; ".join([str(v) for v in val.all()])              elif isinstance(val, (tuple, list, dict)):                  pass              else: @@ -214,13 +214,6 @@ class ValueGetter(object):              value_list.append((key, str(values[key])))          for global_var in GlobalVar.objects.all():              values[global_var.slug] = global_var.value or "" -        if not filtr or 'VALUES' in filtr: -            values['VALUES'] = json.dumps( -                values, indent=4, sort_keys=True, -                skipkeys=True, ensure_ascii=False, -                separators=("", " : "), -            ).replace(" " * 4, "\t") -          return values      @classmethod @@ -1459,7 +1452,14 @@ class DocumentTemplate(models.Model):               ]          )          """ +        filtr = []          values = c_object.get_values() +        if not filtr or 'VALUES' in filtr: +            values['VALUES'] = json.dumps( +                values, indent=4, sort_keys=True, +                skipkeys=True, ensure_ascii=False, +                separators=("", " : "), +            ).replace(" " * 4, "\t")          engine = IshtarSecretaryRenderer()          try:              result = engine.render(self.template, **values) diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 903d1d970..d2e118c7a 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -1745,8 +1745,7 @@ class Town(Imported, models.Model):                    'year': self.year or ""}          return values -    def get_values(self, prefix='', no_values=False, filtr=None, -                   no_base_finds=True): +    def get_values(self, prefix='', **kwargs):          return {              prefix or "label": str(self),              prefix + "name": self.name, | 
