mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 15:12:25 +00:00
Vue pour les zones, contenant les enregistrement origin
This commit is contained in:
parent
cbef3b295b
commit
3604491582
3 changed files with 20 additions and 1 deletions
|
@ -32,6 +32,16 @@ class TypeSerializer(serializers.ModelSerializer):
|
||||||
model = IpType
|
model = IpType
|
||||||
fields = ('type', 'extension', 'domaine_ip', 'domaine_range')
|
fields = ('type', 'extension', 'domaine_ip', 'domaine_range')
|
||||||
|
|
||||||
|
class ExtensionSerializer(serializers.ModelSerializer):
|
||||||
|
origin = serializers.SerializerMethodField('get_origin_ip')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Extension
|
||||||
|
fields = ('name', 'origin')
|
||||||
|
|
||||||
|
def get_origin_ip(self, obj):
|
||||||
|
return obj.origin.ipv4
|
||||||
|
|
||||||
class MxSerializer(serializers.ModelSerializer):
|
class MxSerializer(serializers.ModelSerializer):
|
||||||
name = serializers.SerializerMethodField('get_alias_name')
|
name = serializers.SerializerMethodField('get_alias_name')
|
||||||
zone = serializers.SerializerMethodField('get_zone_name')
|
zone = serializers.SerializerMethodField('get_zone_name')
|
||||||
|
|
|
@ -46,4 +46,5 @@ urlpatterns = [
|
||||||
url(r'^rest/corresp/$', views.corresp, name='corresp'),
|
url(r'^rest/corresp/$', views.corresp, name='corresp'),
|
||||||
url(r'^rest/mx/$', views.mx, name='mx'),
|
url(r'^rest/mx/$', views.mx, name='mx'),
|
||||||
url(r'^rest/ns/$', views.ns, name='ns'),
|
url(r'^rest/ns/$', views.ns, name='ns'),
|
||||||
|
url(r'^rest/zones/$', views.zones, name='zones'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -16,7 +16,7 @@ from django.contrib.auth import authenticate, login
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from rest_framework.renderers import JSONRenderer
|
from rest_framework.renderers import JSONRenderer
|
||||||
from machines.serializers import InterfaceSerializer, TypeSerializer, AliasSerializer, MxSerializer, NsSerializer
|
from machines.serializers import InterfaceSerializer, TypeSerializer, AliasSerializer, MxSerializer, ExtensionSerializer, NsSerializer
|
||||||
from reversion import revisions as reversion
|
from reversion import revisions as reversion
|
||||||
|
|
||||||
|
|
||||||
|
@ -695,6 +695,14 @@ def ns(request):
|
||||||
seria = NsSerializer(ns, many=True)
|
seria = NsSerializer(ns, many=True)
|
||||||
return JSONResponse(seria.data)
|
return JSONResponse(seria.data)
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
@login_required
|
||||||
|
@permission_required('serveur')
|
||||||
|
def zones(request):
|
||||||
|
zones = Extension.objects.all()
|
||||||
|
seria = ExtensionSerializer(zones, many=True)
|
||||||
|
return JSONResponse(seria.data)
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('serveur')
|
@permission_required('serveur')
|
||||||
|
|
Loading…
Reference in a new issue