コード例 #1
0
ファイル: search.py プロジェクト: addaxagent/agent96
from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mayan.apps.dynamic_search.classes import SearchModel

from .permissions import permission_group_view, permission_user_view
from .querysets import get_user_queryset

group_search = SearchModel(
    app_label='auth', label=_('Group'), model_name='Group',
    permission=permission_group_view,
    serializer_path='mayan.apps.user_management.serializers.GroupSerializer'
)

group_search.add_model_field(
    field='name', label=_('Name')
)

user_app, user_model = settings.AUTH_USER_MODEL.split('.')

user_search = SearchModel(
    app_label=user_app, label=_('User'), model_name=user_model,
    permission=permission_user_view, queryset=get_user_queryset,
    serializer_path='mayan.apps.user_management.serializers.UserSerializer'
)

user_search.add_model_field(
    field='first_name', label=_('First name')
)
user_search.add_model_field(
    field='email', label=_('Email')
コード例 #2
0
        return term_string.replace('-', '')
    else:
        return term_string


def get_queryset_page_search_queryset():
    # Ignore documents in trash can
    DocumentPage = apps.get_model(app_label='documents',
                                  model_name='DocumentPage')
    return DocumentPage.objects.filter(
        document_version__document__in_trash=False)


document_search = SearchModel(
    app_label='documents',
    list_mode=LIST_MODE_CHOICE_ITEM,
    model_name='Document',
    permission=permission_document_view,
    serializer_path='mayan.apps.documents.serializers.DocumentSerializer')

document_search.add_model_field(field='document_type__label',
                                label=_('Document type'))
document_search.add_model_field(field='versions__mimetype',
                                label=_('MIME type'))
document_search.add_model_field(field='label', label=_('Label'))
document_search.add_model_field(field='description', label=_('Description'))
document_search.add_model_field(
    field='uuid',
    label=_('UUID'),
    transformation_function=transformation_format_uuid)
document_search.add_model_field(field='versions__checksum',
                                label=_('Checksum'))
コード例 #3
0
ファイル: search.py プロジェクト: dalalsunil1986/progededms
from mayan.apps.documents.search import document_page_search, document_search
from mayan.apps.dynamic_search.classes import SearchModel

from .permissions import permission_cabinet_view


def transformation_format_uuid(term_string):
    if connection.vendor in ('mysql', 'sqlite'):
        return term_string.replace('-', '')
    else:
        return term_string


cabinet_search = SearchModel(
    app_label='cabinets',
    model_name='CabinetSearchResult',
    permission=permission_cabinet_view,
    serializer_path='mayan.apps.cabinets.serializers.CabinetSerializer')

cabinet_search.add_model_field(field='label')

cabinet_search.add_model_field(field='documents__document_type__label',
                               label=_('Document type'))
cabinet_search.add_model_field(field='documents__versions__mimetype',
                               label=_('Document MIME type'))
cabinet_search.add_model_field(field='documents__label',
                               label=_('Document label'))
cabinet_search.add_model_field(field='documents__description',
                               label=_('Document description'))
cabinet_search.add_model_field(
    field='documents__uuid',
コード例 #4
0
ファイル: search.py プロジェクト: addaxagent/agent96
from django.utils.translation import ugettext_lazy as _

from mayan.apps.dynamic_search.classes import SearchModel

from .permissions import permission_role_view

role_search = SearchModel(
    app_label='permissions', model_name='Role',
    permission=permission_role_view,
    serializer_path='mayan.apps.permissions.serializers.RoleSerializer'
)

role_search.add_model_field(
    field='label', label=_('Label')
)

role_search.add_model_field(
    field='groups__name', label=_('Group name')
)
コード例 #5
0
ファイル: search.py プロジェクト: addaxagent/agent96
from django.utils.translation import ugettext_lazy as _

from mayan.apps.dynamic_search.classes import SearchModel

from .permissions import permission_tag_view

tag_search = SearchModel(
    app_label='tags',
    model_name='Tag',
    permission=permission_tag_view,
    serializer_path='mayan.apps.tags.serializers.TagSerializer')

tag_search.add_model_field(field='label', label=_('Label'))

tag_search.add_model_field(field='color', label=_('Color'))
コード例 #6
0
ファイル: search.py プロジェクト: addaxagent/agent96
from mayan.apps.dynamic_search.classes import SearchModel

from .permissions import permission_document_indexing_instance_view


def transformation_format_uuid(term_string):
    if connection.vendor in ('mysql', 'sqlite'):
        return term_string.replace('-', '')
    else:
        return term_string


index_instance_node_search = SearchModel(
    app_label='document_indexing',
    model_name='IndexInstanceNodeSearchResult',
    permission=permission_document_indexing_instance_view,
    serializer_path=
    'mayan.apps.document_indexing.serializers.IndexInstanceNodeSerializer')

index_instance_node_search.add_model_field(field='value', label=_('Value'))

index_instance_node_search.add_model_field(
    field='documents__document_type__label', label=_('Document type'))
index_instance_node_search.add_model_field(
    field='documents__versions__mimetype', label=_('Document MIME type'))
index_instance_node_search.add_model_field(field='documents__label',
                                           label=_('Document label'))
index_instance_node_search.add_model_field(field='documents__description',
                                           label=_('Document description'))
index_instance_node_search.add_model_field(
    field='documents__uuid',
コード例 #7
0
ファイル: search.py プロジェクト: dalalsunil1986/progededms
document_search.add_model_field(
    field='metadata__value', label=_('Metadata value')
)

document_page_search.add_model_field(
    field='document_version__document__metadata__metadata_type__name',
    label=_('Metadata type')
)
document_page_search.add_model_field(
    field='document_version__document__metadata__value',
    label=_('Metadata value')
)

metadata_type_search = SearchModel(
    app_label='metadata', model_name='MetadataType',
    permission=permission_metadata_type_view,
    serializer_path='mayan.apps.metadata.serializers.MetadataTypeSerializer'
)

metadata_type_search.add_model_field(
    field='name', label=_('Name')
)
metadata_type_search.add_model_field(
    field='label', label=_('Label')
)
metadata_type_search.add_model_field(
    field='default', label=_('Default')
)
metadata_type_search.add_model_field(
    field='lookup', label=_('Lookup')
)
コード例 #8
0
from __future__ import absolute_import, unicode_literals

from django.utils.translation import ugettext_lazy as _

from mayan.apps.dynamic_search.classes import SearchModel

from .permissions import permission_cabinet_view

cabinet_search = SearchModel(
    app_label='cabinets', model_name='Cabinet',
    permission=permission_cabinet_view,
    serializer_path='mayan.apps.cabinets.serializers.CabinetSerializer'
)

cabinet_search.add_model_field(
    field='label', label=_('Label')
)