创建和处理触发器的框架。
django-triggers的Python项目详细描述
[![覆盖状态](https://coveralls.io/repos/github/vikingco/django triggers/badge.svg)(https://coveralls.io/github/vikingco/django triggers)
[![CI状态](https://travis-ci.org/vikingco/django-triggers.svg?branch=master)(https://travis ci.org/vikingco/django triggers)
稍后
时间。
用法
----
触发器是通过子类化“触发器”模型定义的。` trigger定义所有子触发器的公共数据结构和逻辑。一个
子级只需要重写``u process`方法并将`typed`设置为一个惟一的slug。
示例
--
特定数据,因此创建一个代理模型。
这确保不会创建额外的数据库表。
proxy=true
typed='breakfast'
def process(self,dictionary={}):
prepare_toast()
prepare_juice()
eat()
`````
触发器特定数据
=====
``python
从djtriggers导入触发器。模型导入触发器
类工资单(触发器):
类元数据:
需要一个
的地方才能住在数据库中。
proxy=false
amount=models.integerfield()
recipient=models.foreignkey(user)
def进程(self,dictionary={}):
amount=self.amount
recipient=self.recipient
检查余额()
支付账单(amount,接收者)
````
触发器处理
===
``python
from.models导入BreakfastTrigger
from.exceptions导入processerror
trigger=BreakfastTrigger.objects.get(pk=1)
尝试:
trigger.process()
除了processerror as e:
报告错误(e)
````
延迟处理
==br/>==
=
``python
===br/>``python
<
trigger=breakfastt触发器
trigger=breakfastt触发器
<
```>
`==
`=
`=
`=
`=
````````````````/>
[![CI状态](https://travis-ci.org/vikingco/django-triggers.svg?branch=master)(https://travis ci.org/vikingco/django triggers)
稍后
时间。
用法
----
触发器是通过子类化“触发器”模型定义的。` trigger定义所有子触发器的公共数据结构和逻辑。一个
子级只需要重写``u process`方法并将`typed`设置为一个惟一的slug。
示例
--
特定数据,因此创建一个代理模型。
这确保不会创建额外的数据库表。
proxy=true
typed='breakfast'
def process(self,dictionary={}):
prepare_toast()
prepare_juice()
eat()
`````
触发器特定数据
=====
``python
从djtriggers导入触发器。模型导入触发器
类工资单(触发器):
类元数据:
需要一个
的地方才能住在数据库中。
proxy=false
amount=models.integerfield()
recipient=models.foreignkey(user)
def进程(self,dictionary={}):
amount=self.amount
recipient=self.recipient
检查余额()
支付账单(amount,接收者)
````
触发器处理
===
``python
from.models导入BreakfastTrigger
from.exceptions导入processerror
trigger=BreakfastTrigger.objects.get(pk=1)
尝试:
trigger.process()
除了processerror as e:
报告错误(e)
````
延迟处理
==br/>==
=
``python
===br/>``python
<
trigger=breakfastt触发器
trigger=breakfastt触发器
<
```>
`==
`=
`=
`=
`=
````````````````/>