mirror of
				https://github.com/Tivix/django-rest-auth.git
				synced 2025-10-31 07:47:33 +03:00 
			
		
		
		
	DRF 3 bug: get HttpRequest from DRF request object. Similar to issue #43
This commit is contained in:
		
							parent
							
								
									200dad30fb
								
							
						
					
					
						commit
						c615cd94aa
					
				|  | @ -1,3 +1,4 @@ | ||||||
|  | from django.http import HttpRequest | ||||||
| from rest_framework import serializers | from rest_framework import serializers | ||||||
| from requests.exceptions import HTTPError | from requests.exceptions import HTTPError | ||||||
| from allauth.socialaccount.helpers import complete_social_login | from allauth.socialaccount.helpers import complete_social_login | ||||||
|  | @ -11,6 +12,8 @@ class SocialLoginSerializer(serializers.Serializer): | ||||||
|         access_token = attrs.get('access_token') |         access_token = attrs.get('access_token') | ||||||
|         view = self.context.get('view') |         view = self.context.get('view') | ||||||
|         request = self.context.get('request') |         request = self.context.get('request') | ||||||
|  |         if not isinstance(request, HttpRequest): | ||||||
|  |             request = request._request | ||||||
| 
 | 
 | ||||||
|         if not view: |         if not view: | ||||||
|             raise serializers.ValidationError('View is not defined, pass it ' + |             raise serializers.ValidationError('View is not defined, pass it ' + | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user