aboutsummaryrefslogtreecommitdiff
path: root/apps/notes/forms.py
blob: 5ef9f84d995da5a02058f071191fc04af1560745 (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
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', 'color_rgb']
        labels = {
            "name": _("Notebook Name"),
        }