From a2dd48fe13336fa398f15314556ab9ddf2315afc Mon Sep 17 00:00:00 2001 From: "Bjarni R. Einarsson" Date: Thu, 4 Aug 2016 01:36:31 +0000 Subject: [PATCH] Work around picture-full-path issue --- vaa/questions/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vaa/questions/views.py b/vaa/questions/views.py index 5687603..5f6f475 100644 --- a/vaa/questions/views.py +++ b/vaa/questions/views.py @@ -75,6 +75,14 @@ def userupdate(request): candidate.picture = data['picture'] candidate.save() + # Work around a weird thing where the full path gets saved and + # relative things stop working. Not sure why the full path gets + # saved, we're doing something wrong somewhere... -bre + cp = candidate.picture + if cp.name.startswith(settings.MEDIA_ROOT): + cp.name = cp.name[len(settings.MEDIA_ROOT)+1:] + candidate.save() + return HttpResponseRedirect("/userpage/")