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 *
24
25class NoteForm(ModelForm):
26 text = forms.CharField(widget=forms.Textarea(attrs={'rows':'20', 'cols':'150'}))
27 title = forms.CharField(widget=forms.Textarea(attrs={'rows':'1', 'cols':'100'}))
28
29 class Meta:
30 model = Note
31 exclude = ('author', 'transformed_text', 'long_summary', 'short_summary', 'created_date', 'modified_date', 'category', 'visibility')
32
33
34class UserForm(ModelForm):
35 def __init__(self, *args, **kwargs):
36 super(UserForm, self).__init__(*args, **kwargs)
37 self.fields['first_name'].label = 'Name'
38 self.fields['username'].help_text = 'Username or email'
39
40 class Meta:
41 model = User
42 fields = ('first_name', 'username', 'password')

Archive Download this file

Branches

Tags