Completed
Push — master ( c6d1c5...bff144 )
by Fox
01:23
created

PushbulletForm

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20

1 Method

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 3 1
1
# coding: utf-8
2
3
from django import forms
4
5
from django.forms import TextInput
6
from th_pushbullet.models import Pushbullet
7
8
PUSH_TYPE = (('note', 'Note'), ('link', 'Link'), ('file', 'File'))
9
10
11
class PushbulletForm(forms.ModelForm):
12
13
    """
14
        for to handle Todoist service
15
    """
16
    type = forms.ChoiceField(widget=forms.Select(
17
        attrs={'class': 'form-control'}))
18
19
    class Meta:
20
        model = Pushbullet
21
        fields = ('type', 'device', 'email', 'channel_tag')
22
        widgets = {
23
            'device': TextInput(attrs={'class': 'form-control'}),
24
            'email': TextInput(attrs={'class': 'form-control'}),
25
            'channel_tag': TextInput(attrs={'class': 'form-control'}),
26
        }
27
28
    def __init__(self, *args, **kwargs):
29
        super(PushbulletForm, self).__init__(*args, **kwargs)
30
        self.fields['type'].choices = PUSH_TYPE
31
32
33
class PushbulletProviderForm(PushbulletForm):
34
    pass
35
36
37
class PushbulletConsumerForm(PushbulletForm):
38
    pass
39