Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Added base ajax views
Browse files Browse the repository at this point in the history
  • Loading branch information
srtab committed Jun 28, 2017
1 parent 8f9d231 commit 6ffdec1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ajax_views/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

from django.views.generic import (
TemplateView, CreateView, UpdateView, DeleteView)

from .mixins import PartialAjaxMixin, FormAjaxMixin, AjaxResponseMixin


class TemplateAjaxView(PartialAjaxMixin, TemplateView):
""" """


class CreateAjaxView(FormAjaxMixin, PartialAjaxMixin, CreateView):
""" """


class UpdateAjaxView(FormAjaxMixin, PartialAjaxMixin, UpdateView):
""" """


class DeleteAjaxView(PartialAjaxMixin, AjaxResponseMixin, DeleteView):
""" """

def delete(self, request, *args, **kwargs):
self.object = self.get_object()
self.object.delete()
return self.json_to_response()

0 comments on commit 6ffdec1

Please sign in to comment.