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

Use IPv6-field and adds ipv6 test data

parent c332f7bc
......@@ -8,8 +8,14 @@ A Django app for managing computer equipment.
python manage.py migrate
python manage.py runserver
## Development tasks
Dump test data:
python manage.py dumpdata mdb --natural-foreign --indent=4 > mdb/fixtures/test_data.json
## Features
* Creates DHCPD configuration files
* Creates DNS zone files for BIND
* TODO: Creates PXE config files (with random secret for use with Puppet autosign)
\ No newline at end of file
* TODO: Creates PXE config files (with random secret for use with Puppet autosign)
This diff is collapsed.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mdb', '0007_auto_20151003_1313'),
]
operations = [
migrations.AlterField(
model_name='ip6address',
name='address',
field=models.GenericIPAddressField(protocol='IPv6'),
),
]
......@@ -353,10 +353,7 @@ class Ip4Subnet(models.Model):
def last_address(self):
subnet = ipaddress.IPv4Network(self.network + "/" + self.netmask)
for curr in subnet.hosts():
pass # horribly inefficient
return curr
return list(subnet.hosts())[-1]
broadcast_address.short_description = 'broadcast'
num_addresses.short_description = '#addresses'
......@@ -560,7 +557,7 @@ class Interface(models.Model):
@python_2_unicode_compatible
class Ip6Address(models.Model):
subnet = models.ForeignKey(Ip6Subnet)
address = models.CharField(max_length=64)
address = models.GenericIPAddressField(protocol='IPv6')
interface = models.ForeignKey(Interface)
def full_address(self):
......
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