2018-11-26 21:08:48 +00:00
|
|
|
"""passbook rule forms"""
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
2018-11-27 15:23:04 +00:00
|
|
|
from passbook.core.models import FieldMatcherRule, WebhookRule
|
2018-11-26 21:08:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FieldMatcherRuleForm(forms.ModelForm):
|
|
|
|
"""FieldMatcherRule Form"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = FieldMatcherRule
|
|
|
|
fields = ['name', 'action', 'negate', 'order',
|
|
|
|
'user_field', 'match_action', 'value', ]
|
|
|
|
widgets = {
|
|
|
|
'name': forms.TextInput(),
|
|
|
|
'user_field': forms.TextInput(),
|
|
|
|
'value': forms.TextInput(),
|
|
|
|
}
|
2018-11-27 15:23:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class WebhookRuleForm(forms.ModelForm):
|
|
|
|
"""WebhookRuleForm Form"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = WebhookRule
|
|
|
|
fields = ['url', 'method', 'json_body', 'json_headers',
|
|
|
|
'result_jsonpath', 'result_json_value', ]
|
|
|
|
widgets = {
|
|
|
|
'json_body': forms.TextInput(),
|
|
|
|
'json_headers': forms.TextInput(),
|
|
|
|
'result_jsonpath': forms.TextInput(),
|
|
|
|
'result_json_value': forms.TextInput(),
|
|
|
|
}
|