From 3defd4c5b39cdf489ec4863f9977f314cc866faf Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 23 May 2019 11:53:33 +0200 Subject: Document generation: manage types --- ishtar_common/models.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 612b57b03..62ad1226d 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -57,6 +57,7 @@ from django.core.validators import validate_slug from django.db import connection from django.db.models import Q, Max, Count from django.db.models.signals import post_save, post_delete, m2m_changed +from django.db.models.fields.related import ManyToManyField, ManyToManyRel from django.db.utils import DatabaseError from django.template.defaultfilters import slugify from django.utils.functional import lazy @@ -149,6 +150,10 @@ class ValueGetter(object): val = values[key] if val is None: val = '' + elif "type" in key and ( + val.__class__.__name__.split('.')[0] + == 'ManyRelatedManager'): + val = [unicode(v) for v in val.all()] elif isinstance(val, (tuple, list, dict)): pass else: -- cgit v1.2.3