You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@senssoft.apache.org by ar...@apache.org on 2016/12/16 17:11:13 UTC

[55/58] [abbrv] incubator-senssoft-tap git commit: Views now respond with JSON instead of HTML

Views now respond with JSON instead of HTML


Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/commit/b3268d5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/tree/b3268d5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/diff/b3268d5c

Branch: refs/heads/master
Commit: b3268d5cb8db8d54169eeb08163269e4074119c2
Parents: 7639d0b
Author: Arthi Vezhavendan <ar...@gmail.com>
Authored: Fri Dec 16 11:39:30 2016 -0500
Committer: Arthi Vezhavendan <ar...@gmail.com>
Committed: Fri Dec 16 11:39:30 2016 -0500

----------------------------------------------------------------------
 app_mgr/views.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/b3268d5c/app_mgr/views.py
----------------------------------------------------------------------
diff --git a/app_mgr/views.py b/app_mgr/views.py
index 10bdd27..57ae1c8 100644
--- a/app_mgr/views.py
+++ b/app_mgr/views.py
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 from django.shortcuts import render, redirect, render_to_response
-from django.http import HttpResponseRedirect, HttpResponse
+from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
 from django.contrib.auth.decorators import login_required
 from django.contrib.auth import authenticate, login, logout, get_user_model
 from django.contrib.auth.views import password_reset, password_reset_confirm
@@ -199,13 +199,15 @@ def register(request):
 
         if not user.email or not request.POST['password']:
             error = True
-            return render_to_response('registration/register.html', {'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error}, context)
+            return JsonResponse({'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error})
+            #return render_to_response('registration/register.html', {'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error}, context)
 
         try:
             user.save()
         except IntegrityError:
             userExists = True
-            return render_to_response('registration/register.html', {'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error}, context)
+            return JsonResponse({'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error})
+            #return render_to_response('registration/register.html', {'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error}, context)
 
         # Now sort out the UserProfile instance.
         # Since we need to set the user attribute ourselves, we set commit=False.
@@ -237,8 +239,9 @@ def register(request):
         # Update this if TAP wants email on registration
         #exp_portal.email.send_email(request)
 
+    return JsonResponse({'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error})
     #return render_to_response('abcd.html', context)
-    return render_to_response('registration/register.html', {'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error}, context)
+    #return render_to_response('registration/register.html', {'registrationSuccessful': registrationSuccessful, 'userExists': userExists, 'error': error}, context)
 
 
 def logout_user(request):