Fix bug introduced by a1c9224

The a1c9224 commit allowed page editing only when their slug had been
changed!
pull/190/head
Serafeim Papastefanos 2014-04-03 21:42:44 +03:00 zatwierdzone przez Matt Westcott
rodzic c1ac89ceb7
commit b442bab7a7
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -234,7 +234,7 @@ def edit(request, page_id):
# Stick an extra validator into the form to make sure that the slug is not already in use
def clean_slug(slug):
# Make sure the slug isn't already in use
if parent.get_children().filter(slug=slug).count() > 0:
if parent.get_children().filter(slug=slug).exclude(id=page_id).count() > 0:
raise ValidationError(_("This slug is already in use"))
return slug
form.fields['slug'].clean = clean_slug