mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 20:03:11 +00:00
Serialize le SOA dans le REST des extensions
This commit is contained in:
parent
aa5cedc37a
commit
9b9f2121c1
2 changed files with 9 additions and 5 deletions
|
@ -285,10 +285,10 @@ class SOA(models.Model):
|
||||||
' {expire};expire\n'
|
' {expire};expire\n'
|
||||||
' {ttl};TTL'
|
' {ttl};TTL'
|
||||||
).format(
|
).format(
|
||||||
refresh=self.refresh,
|
refresh=str(self.refresh).ljust(12),
|
||||||
retry=self.retry,
|
retry=str(self.retry).ljust(12),
|
||||||
expire=self.expire,
|
expire=str(self.expire).ljust(12),
|
||||||
ttl=self.expire
|
ttl=str(self.ttl).ljust(12)
|
||||||
)
|
)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|
|
@ -158,10 +158,11 @@ class ExtensionSerializer(serializers.ModelSerializer):
|
||||||
des foreign_key donc evalués en get_..."""
|
des foreign_key donc evalués en get_..."""
|
||||||
origin = serializers.SerializerMethodField('get_origin_ip')
|
origin = serializers.SerializerMethodField('get_origin_ip')
|
||||||
zone_entry = serializers.SerializerMethodField('get_zone_name')
|
zone_entry = serializers.SerializerMethodField('get_zone_name')
|
||||||
|
soa = serializers.SerializerMethodField('get_soa_data')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Extension
|
model = Extension
|
||||||
fields = ('name', 'origin', 'origin_v6', 'zone_entry')
|
fields = ('name', 'origin', 'origin_v6', 'zone_entry', 'soa')
|
||||||
|
|
||||||
def get_origin_ip(self, obj):
|
def get_origin_ip(self, obj):
|
||||||
return obj.origin.ipv4
|
return obj.origin.ipv4
|
||||||
|
@ -169,6 +170,9 @@ class ExtensionSerializer(serializers.ModelSerializer):
|
||||||
def get_zone_name(self, obj):
|
def get_zone_name(self, obj):
|
||||||
return str(obj.dns_entry)
|
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):
|
class MxSerializer(serializers.ModelSerializer):
|
||||||
"""Serialisation d'un MX, evaluation du nom, de la zone
|
"""Serialisation d'un MX, evaluation du nom, de la zone
|
||||||
|
|
Loading…
Reference in a new issue