Note that currently, there is a bug in the admin: if you create multiple subnets in the same IP pool in one go, then auto-allocation will fail.
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import netfields.fields
+import coin.resources.models
+class Migration(migrations.Migration):
+ dependencies = [
+ ('resources', '0002_ipsubnet_name_server'),
+ ]
+ operations = [
+ migrations.AlterField(
+ model_name='ipsubnet',
+ name='inet',
+ field=netfields.fields.CidrAddressField(validators=[coin.resources.models.validate_subnet], max_length=43, blank=True, help_text='Laisser vide pour allouer automatiquement', unique=True, verbose_name='sous-r\xe9seau'),
+ preserve_default=True,
+ ),
@@ -56,7 +56,7 @@ class IPPool(models.Model):
class IPSubnet(models.Model):
inet = CidrAddressField(blank=True, validators=[validate_subnet],
- verbose_name="sous-réseau",
+ unique=True, verbose_name="sous-réseau",
help_text="Laisser vide pour allouer automatiquement")
objects = NetManager()
ip_pool = models.ForeignKey(IPPool, verbose_name="pool d'IP")