summaryrefslogtreecommitdiff
path: root/app/notes/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/notes/forms.py')
-rw-r--r--app/notes/forms.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/notes/forms.py b/app/notes/forms.py
index f4ca7b9..93cb0be 100644
--- a/app/notes/forms.py
+++ b/app/notes/forms.py
@@ -20,3 +20,21 @@ class NoteCreateForm(ModelForm):
class Meta:
model = Note
fields = ['title', 'url', 'body_markdown', 'post']
+
+
+
+class NoteEditForm(ModelForm):
+
+ def __init__(self,*args,**kwargs):
+ user = kwargs.pop('user')
+ self.user = user
+ super(NoteEditForm,self).__init__(*args,**kwargs)
+ self.fields['post'].queryset = Post.objects.all().order_by("title")
+
+ def save(self, commit=True):
+ self.instance.user = self.user
+ return super().save(commit=commit)
+
+ class Meta:
+ model = Note
+ fields = ['title', 'url', 'body_markdown', 'post', 'status', 'plan']