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']