Dénote

Dénote Git Source Tree

Root/denote/forms.py

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
21from django.forms import ModelForm
22from django import forms
23from denote.models import *
24from datetime import datetime
25
26class 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
35class UserForm(ModelForm):
36
37 password = forms.CharField(required=False)
38
39 def __init__(self, *args, **kwargs):
40 super(UserForm, self).__init__(*args, **kwargs)
41 self.fields['first_name'].label = 'Name'
42 self.fields['username'].help_text = 'Username or email'
43
44 class Meta:
45 model = User
46 fields = ('first_name', 'username', 'password', 'home_notes_visibility')

Archive Download this file

Branches

Tags