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"), }