mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-22 23:13:46 +00:00
Serialize dname export
This commit is contained in:
parent
dd9090a14b
commit
c93cbb1b59
2 changed files with 16 additions and 2 deletions
|
@ -1000,6 +1000,17 @@ class CNAMERecordSerializer(serializers.ModelSerializer):
|
|||
model = machines.Domain
|
||||
fields = ('alias', 'hostname')
|
||||
|
||||
class DNAMERecordSerializer(serializers.ModelSerializer):
|
||||
"""Serialize `machines.models.Domain` objects with the data needed to
|
||||
generate a DNAME DNS record.
|
||||
"""
|
||||
alias = serializers.CharField(read_only=True)
|
||||
zone = serializers.CharField(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = machines.DName
|
||||
fields = ('alias', 'zone')
|
||||
|
||||
|
||||
class DNSZonesSerializer(serializers.ModelSerializer):
|
||||
"""Serialize the data about DNS Zones.
|
||||
|
@ -1014,14 +1025,14 @@ class DNSZonesSerializer(serializers.ModelSerializer):
|
|||
a_records = ARecordSerializer(many=True, source='get_associated_a_records')
|
||||
aaaa_records = AAAARecordSerializer(many=True, source='get_associated_aaaa_records')
|
||||
cname_records = CNAMERecordSerializer(many=True, source='get_associated_cname_records')
|
||||
dname_records = DNAMERecordSerializer(many=True, source='get_associated_dname_records')
|
||||
sshfp_records = SSHFPInterfaceSerializer(many=True, source='get_associated_sshfp_records')
|
||||
|
||||
class Meta:
|
||||
model = machines.Extension
|
||||
fields = ('name', 'soa', 'ns_records', 'originv4', 'originv6',
|
||||
'mx_records', 'txt_records', 'srv_records', 'a_records',
|
||||
'aaaa_records', 'cname_records', 'sshfp_records')
|
||||
|
||||
'aaaa_records', 'cname_records', 'dname_records', 'sshfp_records')
|
||||
#REMINDER
|
||||
|
||||
|
||||
|
|
|
@ -741,6 +741,9 @@ class Extension(RevMixin, AclMixin, models.Model):
|
|||
.filter(cname__interface_parent__in=all_active_assigned_interfaces())
|
||||
.prefetch_related('cname'))
|
||||
|
||||
def get_associated_dname_records(self):
|
||||
return (DName.objects.filter(alias=self))
|
||||
|
||||
@staticmethod
|
||||
def can_use_all(user_request, *_args, **_kwargs):
|
||||
"""Superdroit qui permet d'utiliser toutes les extensions sans
|
||||
|
|
Loading…
Reference in a new issue