Skip to content

Instantly share code, notes, and snippets.

Last active Dec 26, 2015
What would you like to do?
from django.views.generic import UpdateView
from app.views.mixins.ajaxformresponse import AjaxFormResponseMixin
from import UpdateAuthorForm
from app.lib.shortcuts import get_object_or_json404
from 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