Esempio n. 1
0
 class Meta(CustomResourceMeta):
     authentication = RequirePermissionAuthentication(Permissions.edit_data)
     object_class = ESXFormInstance
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     resource_name = 'form'
     ordering = ['received_on', 'server_modified_on']
     serializer = XFormInstanceSerializer(formats=['json'])
Esempio n. 2
0
def _get_form_mock(project, params):
    # this is mostly copy/paste/modified from XFormInstanceResource
    include_archived = 'include_archived' in params
    es_query = es_query_from_get_params(params, project, ['include_archived'])

    query_set = ElasticAPIQuerySet(
        payload=es_query,
        model=ESXFormInstance,
        es_client=FormESView(project),
    ).order_by('received_on')
    return MockApi(query_set, XFormInstanceResource(),
                   XFormInstanceSerializer())