Check for existing liaison titles. Fixes #375

- Legacy-Id: 2509
This commit is contained in:
Emilio A. Sánchez López 2010-08-25 08:52:38 +00:00
parent f78384777b
commit dec12a71b8

View file

@ -207,6 +207,12 @@ class LiaisonForm(forms.ModelForm):
attach_file.write(attached_file.read())
attach_file.close()
def clean_title(self):
title = self.cleaned_data.get('title', None)
exists = bool(LiaisonDetail.objects.filter(title__iexact=title).count())
if exists:
raise forms.ValidationError('A liaison statement with the same title has previously been submitted.')
class IncomingLiaisonForm(LiaisonForm):