From aa76d59a130a30e0859a1faa8cdb6b10e32b6ac8 Mon Sep 17 00:00:00 2001 From: Jeffrey Forman Date: Sun, 2 Dec 2012 09:13:22 -0500 Subject: [PATCH] add choice selection to record type when adding record. works for A/AAAA records. --- binder/forms.py | 2 +- binder/local_settings.py | 3 +-- binder/templates/bcommon/add_record_form.htm | 7 +++++-- binder/views.py | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/binder/forms.py b/binder/forms.py index ffa18b6..34850d6 100644 --- a/binder/forms.py +++ b/binder/forms.py @@ -27,7 +27,7 @@ class FormAddRecord(forms.Form): """ Form used to add a DNS record. """ dns_server = forms.CharField(max_length=100) record_name = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$", required=False) - record_type = forms.CharField(max_length=10) + record_type = forms.ChoiceField(choices=local_settings.RECORD_TYPE_CHOICES) zone_name = forms.CharField(max_length=100) record_data = forms.GenericIPAddressField() ttl = forms.ChoiceField(choices=local_settings.TTL_CHOICES) diff --git a/binder/local_settings.py b/binder/local_settings.py index 4b48764..a7a7f32 100644 --- a/binder/local_settings.py +++ b/binder/local_settings.py @@ -7,5 +7,4 @@ TTL_CHOICES = ((300, "5 minutes"), (86400, "1 day")) RECORD_TYPE_CHOICES = (("A", "A"), - ("AAAA", "AAAA"), - ("CNAME", "CNAME")) + ("AAAA", "AAAA")) diff --git a/binder/templates/bcommon/add_record_form.htm b/binder/templates/bcommon/add_record_form.htm index 5f19d71..947dd1f 100644 --- a/binder/templates/bcommon/add_record_form.htm +++ b/binder/templates/bcommon/add_record_form.htm @@ -36,8 +36,11 @@ Add record in {{ zone_name }}
diff --git a/binder/views.py b/binder/views.py index 684bee8..b177622 100644 --- a/binder/views.py +++ b/binder/views.py @@ -66,6 +66,7 @@ def view_add_record(request, dns_server, zone_name): "zone_name" : zone_name, "tsig_keys" : models.Key.objects.all(), "ttl_choices" : local_settings.TTL_CHOICES, + "record_type_choices" : local_settings.RECORD_TYPE_CHOICES, }) def view_add_record_result(request):