summaryrefslogtreecommitdiff
path: root/app/gtd/forms.py
blob: 3e93a026cfedb6d01928292217d4dddeacb72e2f (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from django.forms import ModelForm

from .models import GTDNote, GTDProject, WiredNote, WiredPost


class GTDNoteCreateForm(ModelForm):
    class Meta:
        model = GTDNote
        fields = ['title', 'url', 'body_markdown', 'project', 'note_type', 'reminder', 'status']


class GTDNoteEditForm(ModelForm):
    class Meta:
        model = GTDNote
        fields = ['title', 'url', 'body_markdown', 'project', 'note_type', 'reminder', 'status']


class GTDProjectCreateForm(ModelForm):
    class Meta:
        model = GTDProject
        fields = ['title', 'body_markdown', 'date_goal', 'project_type', 'outcome']


class GTDProjectUpdateForm(ModelForm):
    class Meta:
        model = GTDProject
        fields = ['title', 'body_markdown', 'date_goal', 'project_type', 'outcome', 'date_ended']


class WiredNoteEditForm(ModelForm):

    def __init__(self, *args, **kwargs):
        super(WiredNoteEditForm, self).__init__(*args, **kwargs)
        self.fields['post'].queryset = WiredPost.objects.all().order_by("title")

    def save(self, commit=True):
        return super().save(commit=commit)

    class Meta:
        model = WiredNote
        fields = ['title', 'url', 'body_markdown', 'post', 'status', 'plan']


class WiredPostUpdateForm(ModelForm):

    class Meta:
        model = WiredPost
        fields = ['title', 'post_status', 'url', 'template_type', 'update_frequency', 'edit_url', 'date_last_pub']