From 228a964e91bafba106d785861ab5c2c092141415 Mon Sep 17 00:00:00 2001 From: Tamas Szabo Date: Fri, 5 Oct 2018 16:02:25 +0300 Subject: [PATCH] Adds description field to IPRange model. Fixes #51. --- iprestrict/admin.py | 2 +- .../migrations/0007_iprange_description.py | 20 +++++++++++++++++++ iprestrict/models.py | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 iprestrict/migrations/0007_iprange_description.py diff --git a/iprestrict/admin.py b/iprestrict/admin.py index 143ce0e..c8705f8 100644 --- a/iprestrict/admin.py +++ b/iprestrict/admin.py @@ -63,7 +63,7 @@ class IPRangeInline(admin.TabularInline): model = models.IPRange form = IPRangeForm - fields = ['first_ip', 'cidr_prefix_length', 'last_ip', 'ip_type'] + fields = ['first_ip', 'cidr_prefix_length', 'last_ip', 'ip_type', 'description'] readonly_fields = ['ip_type'] extra = 2 diff --git a/iprestrict/migrations/0007_iprange_description.py b/iprestrict/migrations/0007_iprange_description.py new file mode 100644 index 0000000..72d93dd --- /dev/null +++ b/iprestrict/migrations/0007_iprange_description.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-10-05 13:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('iprestrict', '0006_auto_20161013_1327'), + ] + + operations = [ + migrations.AddField( + model_name='iprange', + name='description', + field=models.CharField(blank=True, max_length=500), + ), + ] diff --git a/iprestrict/models.py b/iprestrict/models.py index 88c7ee6..05ff463 100644 --- a/iprestrict/models.py +++ b/iprestrict/models.py @@ -136,6 +136,7 @@ class Meta: first_ip = models.GenericIPAddressField() cidr_prefix_length = models.PositiveSmallIntegerField(null=True, blank=True) last_ip = models.GenericIPAddressField(null=True, blank=True) + description = models.CharField(max_length=500, blank=True) @property def start(self):