From b261ee692dfb3cd47d52db03285291e97b507059 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 10 May 2018 17:41:18 +0300 Subject: [PATCH] Fix update photo from fb --- apps/auth/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/auth/views.py b/apps/auth/views.py index 4e173b1b..77f3a37f 100644 --- a/apps/auth/views.py +++ b/apps/auth/views.py @@ -1,3 +1,5 @@ +import os + from uuid import uuid4 from urllib.parse import urlsplit @@ -182,7 +184,7 @@ class FacebookLoginOrRegistration(View): login(requests, user=user) return JsonResponse({"success": True}) else: - if not user.photo and photo_data: + if (not user.photo or (user.photo and not os.path.isfile(user.photo.path))) and photo_data: photo = ContentFile(photo_data) fname = str(fb_id) + '.jpg' user.photo.save(fname, photo, save=True)