Answer the question
In order to leave comments, you need to log in
TypeError: 'NoneType' object is not subscriptable. Where is the error in the Django application?
TypeError: 'NoneType' object is not subscriptable
if request['user_type']=='driver' and not Driver.objects.filter(user_id = user.id):
TypeError: 'NoneType' object is not subscriptable
from TarFoodApp.models import Customer,Driver
def create_user_by_type(backend , user , request , response , *args, **kwargs):
if backend.name == 'facebook':
avatar = 'http://graph.facebook.com/%s/picture?type=large' % response['id']
if request['user_type'] =='driver' and not Driver.objects.filter(user_id = user.id):
Driver.objects.create(user_id=user.id,avatar=avatar)
elif not Customer.objects.filter(user_id=user.id):
Customer.objects.create(user_id=user.id, avatar=avatar)
Answer the question
In order to leave comments, you need to log in
decision
def create_user_by_type(backend , user , response , *args, **kwargs):
request = backend.strategy.request_data()
if backend.name == 'facebook':
avatar = 'http://graph.facebook.com/%s/picture?type=large' % response['id']
if request['user_type'] == 'driver' and not Driver.objects.filter(user_id = user.id):
Driver.objects.create(user_id=user.id,avatar=avatar)
elif not Customer.objects.filter(user_id=user.id):
Customer.objects.create(user_id=user.id, avatar=avatar)
request['user'] there is no such thing, there is request.user the full code of the view would not hurt or where is this error
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question