-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
forms.py
33 lines (28 loc) · 971 Bytes
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from django import forms
from notification.models import NotificationHooks
from reNgine.validators import validate_url
class AddNotificationHooks(forms.ModelForm):
class Meta:
model = NotificationHooks
fields = '__all__'
hook_name = forms.CharField(
required=True,
widget=forms.TextInput(
attrs={
'class': 'form-control',
'id': 'hookName',
'placeholder': '#awesome-channel'
}
))
hook_url = forms.CharField(
validators=[validate_url],
required=False,
widget=forms.TextInput(
attrs={
'class': 'form-control',
'id': 'hookUrl',
'placeholder': 'https://hooks.slack.com/services/T00000000/' +
'B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
}
))
send_notif = forms.BooleanField(widget=forms.HiddenInput(), initial=True)