Commit 5abdef61 authored by Venkat's avatar Venkat
Browse files

Merge branch 'master' of https://gitlab.cs.ksu.edu/brdunn/ipam

parents 26f1402f 1629ed9d
# Generated by Django 2.2 on 2019-05-07 16:56
# Generated by Django 2.2 on 2019-05-12 19:59
from django.conf import settings
from django.db import migrations, models
......@@ -56,8 +56,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('subnet_name', models.CharField(default='Sub', max_length=128)),
('preamble', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='Subnet', to='ipam.Preamble')),
('role', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='Subnet', to='ipam.Role')),
('preamble', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='subnet', to='ipam.Preamble')),
('role', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='subnet', to='ipam.Role')),
],
),
migrations.CreateModel(
......@@ -65,7 +65,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('record_type', models.CharField(choices=[('A', 'A'), ('AAAA', 'AAAA'), ('ALIAS', 'ALIAS'), ('cname', 'cname'), ('MX', 'MX'), ('NS', 'NS'), ('PTR', 'PTR'), ('SOA', 'SOA')], max_length=12)),
('host', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='Host', to='ipam.Host')),
('host', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='records', to='ipam.Host')),
],
),
migrations.CreateModel(
......@@ -73,7 +73,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('mac', models.CharField(max_length=18)),
('adapter', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='Mac', to='ipam.Adapter')),
('adapter', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='mac', to='ipam.Adapter')),
],
),
migrations.CreateModel(
......@@ -89,6 +89,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='adapter',
name='host',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='Adapter', to='ipam.Host'),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='adapter', to='ipam.Host'),
),
]
......@@ -6,13 +6,11 @@ class RecordSerializer(serializers.ModelSerializer):
class Meta:
model = Record
fields = '__all__'
depth = 5
class HostSerializer(serializers.ModelSerializer):
class Meta:
model = Host
fields = ('host_name', 'records')
depth = 1
fields = '__all__'
class AdapterSerializer(serializers.ModelSerializer):
class Meta:
......@@ -23,7 +21,6 @@ class MacAddrSerializer(serializers.ModelSerializer):
class Meta:
model = Mac_Addr
fields = '__all__'
depth = 1
class RoleSerializer(serializers.ModelSerializer):
class Meta:
......
......@@ -27,7 +27,7 @@ class ListIPRange(generics.ListAPIView):
# permission_classes = (permissions.IsAuthenticated)
serializer_class = serializers.IPSerializer
class CreateAndListRecord(generics.ListCreateAPIView):
class CreateRecord(generics.CreateAPIView):
queryset = models.Record.objects.all()
# permission_classes = (permissions.IsAuthenticated)
serializer_class = serializers.RecordSerializer
......@@ -37,12 +37,12 @@ class CreateHost(generics.ListCreateAPIView):
# permission_classes = (permissions.IsAuthenticated)
serializer_class = serializers.HostSerializer
class CreateAdapter(generics.ListCreateAPIView):
class CreateAdapter(generics.CreateAPIView):
queryset = models.Adapter.objects.all()
# permission_classes = (permissions.IsAuthenticated)
serializer_class = serializers.AdapterSerializer
class CreateMac(generics.ListCreateAPIView):
class CreateMac(generics.CreateAPIView):
queryset = models.Mac_Addr.objects.all()
# permission_classes = (permissions.IsAuthenticated)
serializer_class = serializers.MacAddrSerializer
......@@ -76,3 +76,8 @@ class UpdateMac(generics.UpdateAPIView):
queryset = models.Mac_Addr.objects.all()
# permission_classes = (permissions.IsAuthenticated)
serializer_class = serializers.MacAddrSerializer
class ListRecord(generics.ListAPIView):
queryset = models.Record.objects.all()
#permission_class = (permissions.IsAuthenticated)
serializer_class = serializers.RecordSerializer
\ No newline at end of file
......@@ -7,8 +7,8 @@ urlpatterns = [
url(r'^ipam/listavailaleips/', view=views.ListAvailaleIPs.as_view()),
url(r'^ipam/listallips/', view=views.CreateAndListIps.as_view()),
url(r'^ipam/listsubnets/', view=views.ListSubnet.as_view()),
url(r'^ipam/listrecords/', view=views.CreateAndListRecord.as_view()),
url(r'^ipam/createrecord/', view=views.CreateAndListRecord.as_view()),
url(r'^ipam/listrecords/', view=views.ListRecord.as_view()),
url(r'^ipam/createrecord/', view=views.CreateRecord.as_view()),
url(r'^ipam/createhost/', view=views.CreateHost.as_view()),
url(r'^ipam/createadapter/', view=views.CreateAdapter.as_view()),
url(r'^ipam/createmac/', view=views.CreateMac.as_view()),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment