Skip to content

Instantly share code, notes, and snippets.

@zetas
Created February 12, 2014 20:34
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 zetas/8963973 to your computer and use it in GitHub Desktop.
Save zetas/8963973 to your computer and use it in GitHub Desktop.
User verify ajax method
class LicenseVerifyView(View):
def render_to_json_response(self, context, **response_kwargs):
data = json.dumps(context)
response_kwargs['content_type'] = 'application/json'
return HttpResponse(data, **response_kwargs)
def get(self, request, *args, **kwargs):
if request.is_ajax():
data = {
'license_status': request.user.get_license_status(),
'account_type': request.user.account_type,
}
return self.render_to_json_response(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment