1 | # -*- coding: utf-8 -*-␊ |
2 | """␊ |
3 | Copyright 2015 Grégory Soutadé␊ |
4 | ␊ |
5 | This file is part of Dénote.␊ |
6 | ␊ |
7 | Dénote is free software: you can redistribute it and/or modify␊ |
8 | it under the terms of the GNU General Public License as published by␊ |
9 | the Free Software Foundation, either version 3 of the License, or␊ |
10 | (at your option) any later version.␊ |
11 | ␊ |
12 | Dénote is distributed in the hope that it will be useful,␊ |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of␊ |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the␊ |
15 | GNU General Public License for more details.␊ |
16 | ␊ |
17 | You should have received a copy of the GNU General Public License␊ |
18 | along with Dénote. If not, see <http://www.gnu.org/licenses/>.␊ |
19 | """␊ |
20 | ␊ |
21 | from django.forms import ModelForm␊ |
22 | from django import forms␊ |
23 | from denote.models import *␊ |
24 | from datetime import datetime␊ |
25 | ␊ |
26 | class NoteForm(ModelForm):␊ |
27 | text = forms.CharField(widget=forms.Textarea(attrs={'rows':'20', 'cols':'150'}))␊ |
28 | title = forms.CharField(widget=forms.Textarea(attrs={'rows':'1', 'cols':'100'}))␊ |
29 | ␊ |
30 | class Meta:␊ |
31 | model = Note␊ |
32 | exclude = ('author', 'transformed_text', 'long_summary', 'short_summary', 'created_date', 'modified_date', 'category')␊ |
33 | ␊ |
34 | class TemplateForm(ModelForm):␊ |
35 | text = forms.CharField(widget=forms.Textarea(attrs={'rows':'20', 'cols':'150'}), required=False)␊ |
36 | title = forms.CharField(widget=forms.Textarea(attrs={'rows':'1', 'cols':'100'}), required=False)␊ |
37 | ␊ |
38 | class Meta:␊ |
39 | model = Template␊ |
40 | exclude = ('author', 'category')␊ |
41 | ␊ |
42 | class UserForm(ModelForm):␊ |
43 | ␊ |
44 | password = forms.CharField(required=False)␊ |
45 | ␊ |
46 | def __init__(self, *args, **kwargs):␊ |
47 | super(UserForm, self).__init__(*args, **kwargs)␊ |
48 | self.fields['first_name'].label = 'Name'␊ |
49 | self.fields['username'].help_text = 'Username or email'␊ |
50 | ␊ |
51 | class Meta:␊ |
52 | model = User␊ |
53 | fields = ('first_name', 'username', 'password', 'home_notes_visibility')␊ |