Skip to content

Commit

Permalink
Exclude self project from siblings
Browse files Browse the repository at this point in the history
  • Loading branch information
stsewd committed Mar 16, 2018
1 parent 365e04d commit 99a23dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion readthedocs/projects/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ def clean_language(self):
if main_project:
if main_project.language == language:
raise forms.ValidationError(format_msg)
if main_project.translations.filter(language=language).exists():
siblings = (main_project.translations
.filter(language=language)
.exclude(pk=project.pk)
.exists())
if siblings:
raise forms.ValidationError(format_msg)
return language

Expand Down

0 comments on commit 99a23dc

Please sign in to comment.