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)