+++ /dev/null
-from django.core import validators
-
-def is_unique_name(slug, all_data):
- from content.models import Document, Folder
- if all_data["folder"] != '' and all_data["id"] == '':
- folder_id = int(all_data["folder"])
- try:
- doc = Document.object.get(folder__exact=folder_id, slug__exact=slug)
- raise validators.ValidationError(u'There is already a document with that name')
- except:
- pass
-
- try:
- folder = Folder.object.get(slug__exact=slug, parent__exact=folder_id)
- raise validators.ValidationError(u'There is already a folder with that name')
- except:
- pass