From bb12346132303efba7f6a5ef1c8503fd8f1f85c1 Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 8 Aug 2018 12:07:31 +0200 Subject: [PATCH] Fix cnames --- api/serializers.py | 5 ++--- machines/models.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/api/serializers.py b/api/serializers.py index 09f06fb9..4d406898 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -816,13 +816,12 @@ class CNAMERecordSerializer(serializers.ModelSerializer): """Serialize `machines.models.Domain` objects with the data needed to generate a CNAME DNS record. """ - alias = serializers.CharField(source='cname.name', read_only=True) + alias = serializers.CharField(source='cname', read_only=True) hostname = serializers.CharField(source='name', read_only=True) - extension = serializers.CharField(source='extension.name', read_only=True) class Meta: model = machines.Domain - fields = ('alias', 'hostname', 'extension') + fields = ('alias', 'hostname') class DNSZonesSerializer(serializers.ModelSerializer): diff --git a/machines/models.py b/machines/models.py index f109b217..c7dd3a6b 100644 --- a/machines/models.py +++ b/machines/models.py @@ -712,8 +712,7 @@ class Extension(RevMixin, AclMixin, models.Model): from re2o.utils import all_active_assigned_interfaces return (Domain.objects .filter(extension=self) - .filter(cname__isnull=False) - .filter(interface_parent__in=all_active_assigned_interfaces()) + .filter(cname__interface_parent__in=all_active_assigned_interfaces()) .prefetch_related('cname')) @staticmethod