From a3adf44ea152847732c051fb5132fb558c71ed09 Mon Sep 17 00:00:00 2001 From: Mael Kervella Date: Mon, 26 Dec 2016 23:48:32 +0000 Subject: [PATCH] =?UTF-8?q?Stretch=20fix=20Correction=20de=20la=20g=C3=A9n?= =?UTF-8?q?=C3=A9ration=20des=20PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/cotisations/factures.tex | 2 +- machines/serializers.py | 23 +++++++++---------- machines/views.py | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cotisations/templates/cotisations/factures.tex b/cotisations/templates/cotisations/factures.tex index 9647f466..03b8351f 100644 --- a/cotisations/templates/cotisations/factures.tex +++ b/cotisations/templates/cotisations/factures.tex @@ -60,7 +60,7 @@ Siret : {{siret}} \\ \\ {\bf À :} \tab {{dest.name}} {{dest.surname}} \\ % Invoice recipient -{\bf Adresse :} \tab {% if dest.room = None %} Aucune adresse renseignée {% else %}{{dest.room}}{% endif %} \\ +{\bf Adresse :} \tab {% if dest.room == None %} Aucune adresse renseignée {% else %}{{dest.room}}{% endif %} \\ {\bf Date:} \tab {{DATE}} \\ % Invoice date diff --git a/machines/serializers.py b/machines/serializers.py index aff398a3..42aa09f5 100644 --- a/machines/serializers.py +++ b/machines/serializers.py @@ -17,9 +17,8 @@ class IpListSerializer(serializers.ModelSerializer): class InterfaceSerializer(serializers.ModelSerializer): ipv4 = IpListSerializer(read_only=True) mac_address = serializers.SerializerMethodField('get_macaddress') - dns = serializers.SerializerMethodField('get_dns') domain = serializers.SerializerMethodField('get_dns') - extension = serializers.SerializerMethodField('get_extension') + extension = serializers.SerializerMethodField('get_interface_extension') class Meta: model = Interface @@ -28,7 +27,7 @@ class InterfaceSerializer(serializers.ModelSerializer): def get_dns(self, obj): return obj.domain.name - def get_extension(self, obj): + def get_interface_extension(self, obj): return obj.domain.extension.name def get_macaddress(self, obj): @@ -56,22 +55,22 @@ class ExtensionSerializer(serializers.ModelSerializer): return obj.origin.ipv4 class MxSerializer(serializers.ModelSerializer): - name = serializers.SerializerMethodField('get_name') + name = serializers.SerializerMethodField('get_mx_name') zone = serializers.SerializerMethodField('get_zone_name') class Meta: model = Mx fields = ('zone', 'priority', 'name') - def get_name(self, obj): - return obj.name + def get_mx_name(self, obj): + return str(obj.name) def get_zone_name(self, obj): return obj.zone.name class NsSerializer(serializers.ModelSerializer): zone = serializers.SerializerMethodField('get_zone_name') - ns = serializers.SerializerMethodField('get_interface_name') + ns = serializers.SerializerMethodField('get_domain_name') class Meta: model = Ns @@ -80,12 +79,12 @@ class NsSerializer(serializers.ModelSerializer): def get_zone_name(self, obj): return obj.zone.name - def get_interface_name(self, obj): - return obj.ns + def get_domain_name(self, obj): + return str(obj.ns) class DomainSerializer(serializers.ModelSerializer): extension = serializers.SerializerMethodField('get_zone_name') - cname = serializers.SerializerMethodField('get_cname') + cname = serializers.SerializerMethodField('get_cname_name') class Meta: model = Domain @@ -94,6 +93,6 @@ class DomainSerializer(serializers.ModelSerializer): def get_zone_name(self, obj): return obj.extension.name - def get_cname(self, obj): - return obj.cname + def get_cname_name(self, obj): + return str(obj.cname) diff --git a/machines/views.py b/machines/views.py index b7a36615..61e18628 100644 --- a/machines/views.py +++ b/machines/views.py @@ -706,7 +706,7 @@ def interface_list(request): @login_required @permission_required('serveur') def alias(request): - alias = Domain.objects.filter(interface_parent=None).filter(cname=Domain.objects.filter(interface_parent__in=Interface.objects.exclude(ipv4=None))) + alias = Domain.objects.filter(interface_parent=None).filter(cname__in=Domain.objects.filter(interface_parent__in=Interface.objects.exclude(ipv4=None))) seria = DomainSerializer(alias, many=True) return JSONResponse(seria.data)