aboutsummaryrefslogtreecommitdiff
path: root/apps/notes/forms.py
blob: 6a27ec9ef8e53af1849c87fde61b1819c0245948 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from django import forms
from django.utils.translation import ugettext_lazy as _

from .models import Note


class NoteForm(forms.ModelForm):
    class Meta:
        model = Note
        fields = ['title', 'body_markdown', 'url', 'tags']
        labels = {
            "body_markdown": _("Note"),
        }

    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop("user", None)
        super(NoteForm, self).__init__(*args, **kwargs)