Skip to content

Commit

Permalink
Fix error when you dont provide hidden input values for AliasContentF…
Browse files Browse the repository at this point in the history
…orm (#36)
  • Loading branch information
Mateusz Kamycki authored and chaosk committed Oct 8, 2018
1 parent 6aee780 commit 54e6289
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion djangocms_alias/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,14 @@ class Meta:
def clean(self):
cleaned_data = super().clean()

alias = cleaned_data.get('alias')
if not alias:
return cleaned_data

if AliasContent.objects.filter(
name=cleaned_data.get('name'),
language=cleaned_data.get('language'),
alias__category=cleaned_data.get('alias').category,
alias__category=alias.category,
).exists():
raise forms.ValidationError(
_('Alias with this Name and Category already exists.')
Expand Down

0 comments on commit 54e6289

Please sign in to comment.