Added clean method for subproject alias.
@@ -363,6 +363,17 @@ class ProjectRelationshipBaseForm(forms.ModelForm):
)
return child
+ def clean_alias(self):
+ alias = self.cleaned_data['alias']
+ subproject = self.project.subprojects.filter(
+ alias=alias).exclude(id=self.instance.pk)
+
+ if subproject.exists():
+ raise forms.ValidationError(
+ _('A subprojects with this alias already exists'),
+ )
+ return alias
+
def get_subproject_queryset(self):
"""
Return scrubbed subproject choice queryset.
