@login_required
@ensure_csrf_cookie
def change_setting(request):
 u_prof = UserProfile.objects.get(user=request.user)
 if ('location' in request.POST):
  u_prof.location = request.POST['location']
 u_prof.save()
 return JsonResponse({'success': True, 'location': u_prof.location})

@ login_required @ ensure_csrf_cookie def change_setting ( request ) : u_prof = UserProfile . objects . get ( user = request . user ) if ( 'location' in request . POST ) : u_prof . location = request . POST [ 'location' ] u_prof . save ( ) return JsonResponse ( { 'success' : True , 'location' : u_prof . location } )
json call to change a profile setting: right now .