I would like to only take input of A or B from HTML Form I create... But this one did not work. I have tried if type is not 'A' or 'B' or using !=.. nothing worked. What is the right code for it?
forms.py
class YamlForm(forms.ModelForm):
class Meta:
    model = Form_info
    fields = '__all__'
    # fields = ['name', 'type', 'vlan_id', 'rdp', 'ip_master', 'ip_backup', 'vip', 'nat_ip', 'cidr', 'dns', 'dhcp', 'dhcp_pool_start', 'dhcp_pool_end']
    widgets = {
        'name': forms.TextInput(attrs={'id': 'name', 'name': 'name'}),
        'vlan_id': forms.TextInput(attrs={'id': 'vlan_id', 'name': 'vlan_id'}),
        'rdp': forms.Select(choices=BOOLEAN_CHOICES),
        'dhcp':forms.Select(choices=BOOLEAN_CHOICES)
    }
    error_messages = {
        'name': {
            'max_length': _("This writer's name is too long."),
        },
    }
def clean_type(self):
        type = self.cleaned_data['type']
        if not 'A' or 'B':
            raise forms.ValidationError("Please enter A or B")
        return type
def clean_vlan_id(self):
        vlan_id = self.cleaned_data.get('vlan_id')
        if vlan_id not in range(1300, 1899):
            raise forms.ValidationError("Pleanse enter the right # in range")
        return vlan_id
my HTML
</div>
<div class="row">
  <div class="col-25">
    <label for="type">TYPE:</label>
  </div>
  <div class="col-75">
    <span class="text-danger" small>{{ form.type.errors }}</span>
      {{ form.type }}
  </div>


if not 'A' or 'B':is this really what's in your code ?