47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Copyright 2015 Grégory Soutadé
|
|
|
|
This file is part of Dénote.
|
|
|
|
Dénote is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
Dénote is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Dénote. If not, see <http://www.gnu.org/licenses/>.
|
|
"""
|
|
|
|
from django.forms import ModelForm
|
|
from django import forms
|
|
from denote.models import *
|
|
from datetime import datetime
|
|
|
|
class NoteForm(ModelForm):
|
|
text = forms.CharField(widget=forms.Textarea(attrs={'rows':'20', 'cols':'150'}))
|
|
title = forms.CharField(widget=forms.Textarea(attrs={'rows':'1', 'cols':'100'}))
|
|
|
|
class Meta:
|
|
model = Note
|
|
exclude = ('author', 'transformed_text', 'long_summary', 'short_summary', 'created_date', 'modified_date', 'category')
|
|
|
|
|
|
class UserForm(ModelForm):
|
|
|
|
password = forms.CharField(required=False)
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super(UserForm, self).__init__(*args, **kwargs)
|
|
self.fields['first_name'].label = 'Name'
|
|
self.fields['username'].help_text = 'Username or email'
|
|
|
|
class Meta:
|
|
model = User
|
|
fields = ('first_name', 'username', 'password', 'home_notes_visibility')
|