<s> from dj . choices import Choices <EOL> from django import forms <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> class RecordType ( Choices ) : <EOL> _ = Choices . Choice <EOL> a = _ ( '<STR_LIT:A>' ) <EOL> txt = _ ( '<STR_LIT>' ) <EOL> cname = _ ( '<STR_LIT>' ) <EOL> class DNSRecordForm ( forms . Form ) : <EOL> pk = forms . IntegerField ( <EOL> label = '<STR_LIT>' , <EOL> widget = forms . HiddenInput ( ) , <EOL> required = False <EOL> ) <EOL> name = forms . CharField ( <EOL> label = _ ( '<STR_LIT:Name>' ) , <EOL> max_length = <NUM_LIT:255> , <EOL> help_text = _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> ) <EOL> type = forms . ChoiceField ( <EOL> label = _ ( "<STR_LIT>" ) , <EOL> choices = RecordType ( ) , <EOL> ) <EOL> content = forms . CharField ( <EOL> label = _ ( '<STR_LIT>' ) , <EOL> max_length = <NUM_LIT:255> , <EOL> help_text = _ ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) , <EOL> widget = forms . TextInput ( attrs = { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> ) <EOL> ptr = forms . BooleanField ( <EOL> label = _ ( '<STR_LIT>' ) , <EOL> initial = False , <EOL> required = False <EOL> ) <EOL> def clean ( self ) : <EOL> cleaned_data = super ( ) . clean ( ) <EOL> if ( <EOL> cleaned_data . get ( '<STR_LIT>' , False ) and <EOL> cleaned_data . get ( '<STR_LIT:type>' , None ) != str ( RecordType . a . id ) <EOL> ) : <EOL> raise forms . ValidationError ( _ ( '<STR_LIT>' ) ) </s>
