mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-30 00:22:25 +00:00
Serialize le SOA dans le REST des extensions
This commit is contained in:
parent
3b3f6e2f6d
commit
fb035adc8a
2 changed files with 9 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue