Created
February 12, 2014 20:34
-
-
Save zetas/8963973 to your computer and use it in GitHub Desktop.
User verify ajax method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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