Skip to content

Instantly share code, notes, and snippets.

@chriskief
Last active December 26, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskief/7210290 to your computer and use it in GitHub Desktop.
Save chriskief/7210290 to your computer and use it in GitHub Desktop.
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