mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
DNS Zone endpoint is now a viewset
This commit is contained in:
parent
e6884ab4da
commit
197475409c
3 changed files with 8 additions and 4 deletions
|
@ -561,7 +561,7 @@ class CNAMERecordSerializer(serializers.ModelSerializer):
|
|||
fields = ('alias', 'hostname')
|
||||
|
||||
|
||||
class DNSZonesSerializer(serializers.ModelSerializer):
|
||||
class DNSZonesSerializer(NamespacedHMSerializer):
|
||||
soa = SOARecordSerializer()
|
||||
ns_records = NSRecordSerializer(many=True, source='ns_set')
|
||||
originv4 = OriginV4RecordSerializer(source='origin')
|
||||
|
@ -577,4 +577,7 @@ class DNSZonesSerializer(serializers.ModelSerializer):
|
|||
model = machines.Extension
|
||||
fields = ('name', 'soa', 'ns_records', 'originv4', 'originv6',
|
||||
'mx_records', 'txt_records', 'srv_records', 'a_records',
|
||||
'aaaa_records', 'cname_records')
|
||||
'aaaa_records', 'cname_records', 'api_url')
|
||||
extra_kwargs = {
|
||||
'api_url': {'view_name': 'dnszone-detail'}
|
||||
}
|
||||
|
|
|
@ -86,11 +86,12 @@ router.register(r'users/listrights', views.ListRightViewSet)
|
|||
router.register(r'users/shells', views.ShellViewSet, base_name='shell')
|
||||
router.register(r'users/bans', views.BanViewSet)
|
||||
router.register(r'users/whitelists', views.WhitelistViewSet)
|
||||
# DNS
|
||||
router.register(r'dns/zones', views.DNSZonesViewSet, base_name='dnszone')
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', include(router.urls)),
|
||||
url(r'^dhcp/hostmacip', views.HostMacIpView.as_view()),
|
||||
url(r'^dns/zones', views.DNSZonesView.as_view()),
|
||||
url(r'^services/regen', views.ServiceRegenView.as_view()),
|
||||
url(r'^token-auth', views.ObtainExpiringAuthToken.as_view())
|
||||
]
|
||||
|
|
|
@ -340,7 +340,7 @@ class HostMacIpView(generics.ListAPIView):
|
|||
|
||||
# DNS views
|
||||
|
||||
class DNSZonesView(generics.ListAPIView):
|
||||
class DNSZonesViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = machines.Extension.objects.all()
|
||||
serializer_class = serializers.DNSZonesSerializer
|
||||
|
||||
|
|
Loading…
Reference in a new issue