So I set up profile pic upload as guided by http://www.tangowithdjango.com/book/chapters/login.html. Then I found the second answer(by user Raisins) to useful for my purpose and implemented it Extending the User model with custom fields in Django. As I've been that this answer is outdated, I've also tried the solution offered here for migration Get rid of get_profile() in a migration to Django 1.6 which hasn't improved my situation
Then in my views, I add required details including the image to a dictionary, and render i to the HTML page. It looks as though the UserProfile isn't returning the right object.
u=User.object.get(username__exact=request.user)
profile=UserProfile.objects.get(user=u)
global client
client['login']=True
client['name']=u.username
client['password']=u.password
client['email']=u.email
client['picture']=profile.picture
return render(request,'index.html',{'client':client})
And when I try to display the details on HTML page, everything except image is loaded. I tried
<img src="profile_images/{{client.picture}}">
where profile_images is in the root directory. I inspected the element and I find this
<img src="/static/profile_images/%7B%7B%20client.picture%20%7D%7D">
where I was expecting "1.jpg" instead of "%7B%7B%20client.picture%20%7D%7D".
Any help is appreciated. Thanks