用于使用connectwise的django应用程序。定义模型(票据、成员、公司等)和回调。
django-connectwise的Python项目详细描述
django连接方式
用于使用connectwise的django应用程序。定义模型(票据, 成员、公司等)和回拨。
要求
- Python3.5
- Django 2.0
其他的版本也可以,我们还没有尝试过。
安装
来自PYPI:
pip install django-connectwise
来源:
git clone git@github.com:KerkhoffTechnologies/django-connectwise.git
cd django-connectwise
python setup.py install
用法
添加到已安装的应用程序
INSTALLED_APPS = [ ... 'djconnectwise', ... ]
添加到
urls.py
:url( r'^callback/', # This can be whatever you want. include('djconnectwise.urls', namespace='connectwise') ),
添加到设置:
CONNECTWISE_SERVER_URL = 'https://connectwise.example.com' CONNECTWISE_CREDENTIALS = { 'company_id': 'your company ID', 'api_public_key': 'your API user public key', 'api_private_key': 'your API user private key', } CONNECTWISE_TICKET_PATH = 'v4_6_release/services/system_io/router/openrecord.rails' def djconnectwise_configuration(): return { 'timeout': 30.0, # Network timeout in seconds 'batch_size': 50, # Number of records to fetch in each request 'max_attempts': 3, # Number of times to make a request before failing 'callback_url': '{}?id='.format( reverse('connectwise:callback') ), 'callback_host': '{}://{}'.format( 'http' if DEBUG else 'https', 'djconnectwise-host.example.com' ), } DJCONNECTWISE_CONF_CALLABLE = djconnectwise_configuration
对于connectwise云用户,
CONNECTWISE_SERVER_URL
可以只是https://na.myconnectwise.net
-库自动更改为api-region
域。DJCONNECTWISE_CONF_CALLABLE
函数应该返回一个包含上述字段的字典。它是一个可调用的,因此它可以在运行时获取设置-例如从Constance设置。使用此管理命令同步对象:
cwsync
。如果要获取的对象太多,这将需要很长时间。使用管理命令注册回调:
callbacks_registered
使用标准django模型信号查看对象何时更改。
要控制用户头像缩略图的存储方式,请从 easy-thumbnails。
要取消注册回调,请使用callbacks_deleted
管理命令。
测试
准备您的环境:
pip install --upgrade -r requirements_test.txt
尝试下列操作之一:
./runtests.py
python setup.py test
make test
贡献
分叉此回购
创建分支
进行改进
进行迁移?运行:
./makemigrations.py
运行测试(见上文)
发出拉取请求
许可证
麻省理工学院
版权所有
版权所有©2017 Kerkhoff Technologies Inc.