diff --git a/binder/forms.py b/binder/forms.py index 133e46c..ffa18b6 100644 --- a/binder/forms.py +++ b/binder/forms.py @@ -6,14 +6,7 @@ from django.core.exceptions import ValidationError # App Imports from models import Key - -TTL_CHOICES = ((300, "5 minutes"), - (1800, "30 minutes"), - (3600, "1 hour"), - (43200, "12 hours"), - (86400, "1 day")) - -RECORD_TYPE_CHOICES = (("A", "A"), ("AAAA", "AAAA"), ("CNAME", "CNAME")) +import local_settings ### Custom Form Fields @@ -37,7 +30,7 @@ class FormAddRecord(forms.Form): record_type = forms.CharField(max_length=10) zone_name = forms.CharField(max_length=100) record_data = forms.GenericIPAddressField() - ttl = forms.IntegerField(min_value=1) + ttl = forms.ChoiceField(choices=local_settings.TTL_CHOICES) create_reverse = forms.BooleanField(required=False) key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False) @@ -48,7 +41,7 @@ class FormAddCnameRecord(forms.Form): originating_record = forms.CharField(max_length=100) cname = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$") zone_name = forms.CharField(max_length=256) - ttl = forms.ChoiceField(choices=TTL_CHOICES) + ttl = forms.ChoiceField(choices=local_settings.TTL_CHOICES) key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False) class FormDeleteRecord(forms.Form): diff --git a/binder/local_settings.py b/binder/local_settings.py new file mode 100644 index 0000000..4b48764 --- /dev/null +++ b/binder/local_settings.py @@ -0,0 +1,11 @@ +### Local settings to be shared across modules. + +TTL_CHOICES = ((300, "5 minutes"), + (1800, "30 minutes"), + (3600, "1 hour"), + (43200, "12 hours"), + (86400, "1 day")) + +RECORD_TYPE_CHOICES = (("A", "A"), + ("AAAA", "AAAA"), + ("CNAME", "CNAME")) diff --git a/binder/templates/bcommon/add_cname_record_form.htm b/binder/templates/bcommon/add_cname_record_form.htm index 6e973e0..db75ed0 100644 --- a/binder/templates/bcommon/add_cname_record_form.htm +++ b/binder/templates/bcommon/add_cname_record_form.htm @@ -42,7 +42,11 @@ Add CNAME record for {{ originating_record }}