コード例 #1
0
ファイル: admin.py プロジェクト: crepererum/invenio
def is_place_taken(form, field):
    """Check if the given place for given collection is already taken.

    :param form: the form containing the validated field
    :param field: the validated field
    """
    order = field.data
    collection = form.data['collection']
    if not collection:
        return

    if FacetCollection.is_place_taken(collection.id, order):
        raise ValidationError('A facet on the given place already exists')
コード例 #2
0
ファイル: admin.py プロジェクト: crepererum/invenio
def is_place_taken(form, field):
    """Check if the given place for given collection is already taken.

    :param form: the form containing the validated field
    :param field: the validated field
    """
    order = field.data
    collection = form.data['collection']
    if not collection:
        return

    if FacetCollection.is_place_taken(collection.id, order):
        raise ValidationError('A facet on the given place already exists')
コード例 #3
0
ファイル: admin.py プロジェクト: crepererum/invenio
def is_duplicated(form, field):
    """Check if the given facet is already assigned to this collection.

    :param form: the form containing the validated field
    :param field: the validated field
    """
    facet_name = field.data
    collection = form.data['collection']
    if not collection:
        return

    if FacetCollection.is_duplicated(collection.id, facet_name):
        raise ValidationError(
            'This facet is already assigned to this collection.')
コード例 #4
0
ファイル: admin.py プロジェクト: crepererum/invenio
def is_duplicated(form, field):
    """Check if the given facet is already assigned to this collection.

    :param form: the form containing the validated field
    :param field: the validated field
    """
    facet_name = field.data
    collection = form.data['collection']
    if not collection:
        return

    if FacetCollection.is_duplicated(collection.id, facet_name):
        raise ValidationError(
            'This facet is already assigned to this collection.')