]> git.0d.be Git - chloro.git/blob - chloro/phyll/views.py
add basic views to create/edit/delete notes
[chloro.git] / chloro / phyll / views.py
1 # chloro - personal space
2 # Copyright (C) 2019  Frederic Peters
3 #
4 # This program is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published
6 # by the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU Affero General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 from django.views.generic import CreateView, DeleteView, DetailView, UpdateView
18
19 from .models import Note
20
21
22 class NoteView(DetailView):
23     model = Note
24
25
26 class NoteEditView(UpdateView):
27     model = Note
28     fields = ['title', 'slug', 'text', 'tags']
29
30
31 class NoteAddView(CreateView):
32     model = Note
33     fields = ['title', 'slug', 'text', 'tags']
34
35
36 class NoteDeleteView(DeleteView):
37     model = Note
38
39     def get_success_url(self):
40         return '/'