]> git.0d.be Git - chloro.git/blobdiff - chloro/phyll/views.py
add basic views to create/edit/delete notes
[chloro.git] / chloro / phyll / views.py
index cb12807330d270ca4968ff6a7b8630cd27423b8a..d13d6b966c4876f6ee1abf97193475d8a4e3666f 100644 (file)
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from django.views.generic import DetailView
+from django.views.generic import CreateView, DeleteView, DetailView, UpdateView
 
 from .models import Note
 
 
 class NoteView(DetailView):
     model = Note
+
+
+class NoteEditView(UpdateView):
+    model = Note
+    fields = ['title', 'slug', 'text', 'tags']
+
+
+class NoteAddView(CreateView):
+    model = Note
+    fields = ['title', 'slug', 'text', 'tags']
+
+
+class NoteDeleteView(DeleteView):
+    model = Note
+
+    def get_success_url(self):
+        return '/'