Skip to content

Instantly share code, notes, and snippets.

@chriskief

chriskief/view.py

Last active Dec 26, 2015
Embed
What would you like to do?
from django.views.generic import UpdateView
from app.views.mixins.ajaxformresponse import AjaxFormResponseMixin
from app.forms.author import UpdateAuthorForm
from app.lib.shortcuts import get_object_or_json404
from app.models.author import Author
class AjaxAuthorUpdateView(AjaxFormResponseMixin, UpdateView):
form_class = UpdateAuthorForm
def get_object(self, queryset=None):
return get_object_or_json404(Author, pk=self.kwargs['pk'])
def get_context_data(self, context):
context['success'] = True
return context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment