Skip to content

Commit d712ce2

Browse files
committed
Do not include the current liaison when searching if a title exists. Fixes ietf-tools#390
- Legacy-Id: 2563
1 parent ed2e87e commit d712ce2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ietf/liaisons/forms.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ def save_attachments(self, instance):
215215

216216
def clean_title(self):
217217
title = self.cleaned_data.get('title', None)
218-
exists = bool(LiaisonDetail.objects.filter(title__iexact=title).count())
218+
if self.instance and self.instance.pk:
219+
exclude_filter = {'pk': self.instance.pk}
220+
else:
221+
exclude_filter = {}
222+
exists = bool(LiaisonDetail.objects.exclude(**exclude_filter).filter(title__iexact=title).count())
219223
if exists:
220224
raise forms.ValidationError('A liaison statement with the same title has previously been submitted.')
221225
return title

0 commit comments

Comments
 (0)