跳转到主要内容

eTools离线收集应用

项目描述

eTools离线收集使用 unicef_attachments 来处理文件。

安装

$ pip install etools-offline

设置

etools_offline 添加到设置中的 INSTALLED_APPS

INSTALLED_APPS = (
  ...
  'etools_offline',

)

设置eTools离线API设置;

ETOOLS_OFFLINE_API = "http://localhost:8000/api/remote/blueprint/"
ETOOLS_OFFLINE_TOKEN = "123"

用法

钩子发生在序列化器中,因此请更新相关的序列化器;

from etools_offline import OfflineCollect

# add new blueprint
OfflineCollect().add(data={
    "code": "blueprint-123",
    "form_title": "Blueprint 123",
    "form_instructions": json.dumps({"key": "value"}),
    "accessible_by": ["joe@example.com", "mary@example.com"],
    "api_response_url": "http://example.com/response/",
})

response = {
    'id': 88,
    'code':
    'blueprint-123',
    'form_title': 'Blueprint 123',
    'form_instructions': {'key': 'value'},
    'is_active': False,
    'accessible_by': ['joe@example.com', 'mary@example.com'],
    'expiry_date': '2021-02-18',
    'max_forms_allowed': None,
    'api_response_url': 'http://example.com/response/',
    'created': '2020-02-19T15:41:10.016068Z',
    'modified': '2020-02-19T15:41:10.016094Z'
}

# update blueprint
OfflineCollect().update(
  accessible_by="<accessible_by>",
  expiry_date="<expiry_date>",
)

# get list of blueprints
OfflineCollect().list()

# get specific blueprint
OfflineCollect().get(<code>)

# delete blueprint
OfflineCollect().delete(<code>)

贡献

配置开发环境

$ make develop

运行测试

$ make test

项目详情


下载文件

为您的平台下载文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源分布

etools_offline-0.1.0.tar.gz (19.0 kB 查看哈希值)

上传时间:

构建分布

etools_offline-0.1.0-py2.py3-none-any.whl (18.1 kB 查看哈希值)

上传时间: Python 2 Python 3

由以下机构支持