diff --git a/machines/models.py b/machines/models.py index 3017fbac..31f61223 100644 --- a/machines/models.py +++ b/machines/models.py @@ -285,10 +285,10 @@ class SOA(models.Model): ' {expire};expire\n' ' {ttl};TTL' ).format( - refresh=self.refresh, - retry=self.retry, - expire=self.expire, - ttl=self.expire + refresh=str(self.refresh).ljust(12), + retry=str(self.retry).ljust(12), + expire=str(self.expire).ljust(12), + ttl=str(self.ttl).ljust(12) ) @cached_property diff --git a/machines/serializers.py b/machines/serializers.py index 7d222ef0..7d78ebc3 100644 --- a/machines/serializers.py +++ b/machines/serializers.py @@ -158,10 +158,11 @@ class ExtensionSerializer(serializers.ModelSerializer): des foreign_key donc evalués en get_...""" origin = serializers.SerializerMethodField('get_origin_ip') zone_entry = serializers.SerializerMethodField('get_zone_name') + soa = serializers.SerializerMethodField('get_soa_data') class Meta: model = Extension - fields = ('name', 'origin', 'origin_v6', 'zone_entry') + fields = ('name', 'origin', 'origin_v6', 'zone_entry', 'soa') def get_origin_ip(self, obj): return obj.origin.ipv4 @@ -169,6 +170,9 @@ class ExtensionSerializer(serializers.ModelSerializer): def get_zone_name(self, obj): return str(obj.dns_entry) + def get_soa_data(self, obj): + return { 'mail': obj.soa.dns_soa_mail, 'param': obj.soa.dns_soa_param } + class MxSerializer(serializers.ModelSerializer): """Serialisation d'un MX, evaluation du nom, de la zone