Commit ada13fde authored by Nikolai Kristiansen's avatar Nikolai Kristiansen
Browse files

Adds IPv6 domain address support.

Depends on py3 branch
parent b7826993
Pipeline #1 skipped
......@@ -115,7 +115,7 @@ class DomainARecordInline(admin.TabularInline):
class DomainAdmin(admin.ModelAdmin):
inlines = [DomainSrvRecordInline, DomainTxtRecordInline, DomainARecordInline, DomainCnameRecordInline]
list_display = ['domain_name', 'domain_soa', 'domain_admin', 'num_records', 'domain_ipaddr']
list_display = ['domain_name', 'domain_soa', 'domain_admin', 'num_records', 'domain_ipaddr', 'domain_ip6addr']
search_fields = ['domain_name']
......
This diff is collapsed.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import re
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('mdb', '0008_auto_20151004_1258'),
]
operations = [
migrations.AddField(
model_name='domain',
name='domain_ip6addr',
field=models.GenericIPAddressField(null=True, protocol='IPv6', blank=True),
),
migrations.AlterField(
model_name='host',
name='hostname',
field=models.CharField(max_length=64, validators=[django.core.validators.RegexValidator(regex=re.compile('^(?!-)[-a-z0-9]+(?<!-)$', 2), message='Enter a valid hostname', code='invalid')]),
),
migrations.AlterField(
model_name='interface',
name='macaddr',
field=models.CharField(max_length=17, validators=[django.core.validators.RegexValidator(regex=re.compile('^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$', 2), message='Enter a valid MAC address', code='invalid')]),
),
]
......@@ -40,6 +40,7 @@ class Domain(models.Model):
domain_minimum_ttl = models.IntegerField(default=86400)
domain_admin = models.EmailField()
domain_ipaddr = models.GenericIPAddressField(protocol='IPv4')
domain_ip6addr = models.GenericIPAddressField(protocol='IPv6', blank=True, null=True)
domain_filename = models.CharField(max_length=256)
created_date = models.DateTimeField(auto_now_add=True)
......@@ -92,6 +93,9 @@ class Domain(models.Model):
if self.domain_ipaddr is not None:
content += "@\tIN\tA\t%s\n" % self.domain_ipaddr
if self.domain_ip6addr is not None:
content += "@\tIN\tAAAA\t%s\n" % self.domain_ip6addr
content += "; SRV records\n"
for srv in self.domainsrvrecord_set.all():
......
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