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
|
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import Note, Notebook
class NoteForm(forms.ModelForm):
class Meta:
model = Note
fields = ['title', 'body_text', 'body_html', 'body_qjson', 'notebook', 'url', 'tags']
labels = {
"body": _("Note"),
}
def __init__(self, *args, **kwargs):
self.user = kwargs.pop("user", None)
super(NoteForm, self).__init__(*args, **kwargs)
class NotebookForm(NoteForm):
class Meta:
model = Notebook
fields = ['name']
labels = {
"name": _("Notebook Name"),
}
|