Fixed the use of a non-existing model in AddAreaForm. It does however look like this form isn't used anywhere, so I've also commented the code out for now.

- Legacy-Id: 7484
This commit is contained in:
Henrik Levkowetz 2014-03-15 23:22:03 +00:00
parent b9d6d0295e
commit 3893061219

View file

@ -140,24 +140,24 @@ class AddAreaModelForm(forms.ModelForm):
area.save()
return area
class AddAreaForm(forms.Form):
acronym = forms.CharField(max_length=16,required=True)
name = forms.CharField(max_length=80,required=True)
status = forms.IntegerField(widget=forms.Select(choices=STATE_CHOICES),required=True)
start_date = forms.DateField()
comments = forms.CharField(widget=forms.Textarea(attrs={'rows':'1'}),required=False)
def clean_acronym(self):
# get name, strip leading and trailing spaces
name = self.cleaned_data.get('acronym', '').strip()
# check for invalid characters
r1 = re.compile(r'[a-zA-Z\-\. ]+$')
if name and not r1.match(name):
raise forms.ValidationError("Enter a valid acronym (only letters,period,hyphen allowed)")
# ensure doesn't already exist
if Acronym.objects.filter(acronym=name):
raise forms.ValidationError("This acronym already exists. Enter a unique one.")
return name
# class AddAreaForm(forms.Form):
# acronym = forms.CharField(max_length=16,required=True)
# name = forms.CharField(max_length=80,required=True)
# status = forms.IntegerField(widget=forms.Select(choices=STATE_CHOICES),required=True)
# start_date = forms.DateField()
# comments = forms.CharField(widget=forms.Textarea(attrs={'rows':'1'}),required=False)
#
# def clean_acronym(self):
# # get name, strip leading and trailing spaces
# name = self.cleaned_data.get('acronym', '').strip()
# # check for invalid characters
# r1 = re.compile(r'[a-zA-Z\-\. ]+$')
# if name and not r1.match(name):
# raise forms.ValidationError("Enter a valid acronym (only letters,period,hyphen allowed)")
# # ensure doesn't already exist
# if Group.objects.filter(acronym=name).exists():
# raise forms.ValidationError("This acronym already exists. Enter a unique one.")
# return name
class AreaDirectorForm(forms.Form):
ad_name = forms.CharField(max_length=100,label='Name',help_text="To see a list of people type the first name, or last name, or both.")