Simplify the forms modules for handling keys
This commit is contained in:
parent
823da81ed4
commit
b1907b140a
|
@ -1,5 +1,4 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from models import Key
|
from models import Key
|
||||||
|
|
||||||
RECORD_TYPE_CHOICES = (("A", "A"), ("AAAA", "AAAA"), ("CNAME", "CNAME"))
|
RECORD_TYPE_CHOICES = (("A", "A"), ("AAAA", "AAAA"), ("CNAME", "CNAME"))
|
||||||
|
@ -17,7 +16,7 @@ class FormAddRecord(forms.Form):
|
||||||
record_data = forms.GenericIPAddressField()
|
record_data = forms.GenericIPAddressField()
|
||||||
ttl = forms.IntegerField(min_value=1)
|
ttl = forms.IntegerField(min_value=1)
|
||||||
create_reverse = forms.BooleanField(required=False)
|
create_reverse = forms.BooleanField(required=False)
|
||||||
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), empty_label=None, required=False)
|
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False)
|
||||||
|
|
||||||
|
|
||||||
class FormAddCnameRecord(forms.Form):
|
class FormAddCnameRecord(forms.Form):
|
||||||
|
@ -26,4 +25,4 @@ class FormAddCnameRecord(forms.Form):
|
||||||
cname = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$")
|
cname = forms.RegexField(max_length=100, regex="^[a-zA-Z0-9-_]+$")
|
||||||
zone_name = forms.CharField(max_length=256)
|
zone_name = forms.CharField(max_length=256)
|
||||||
ttl = forms.ChoiceField(choices=TTL_CHOICES)
|
ttl = forms.ChoiceField(choices=TTL_CHOICES)
|
||||||
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), empty_label=None, required=False)
|
key_name = forms.ModelChoiceField(queryset=Key.objects.all(), required=False)
|
||||||
|
|
Loading…
Reference in New Issue