我的观点是这样的
image1=UserProfile.objects.get(user_id=request.user)
print(image1.user_image)
update_profile = UpdateProfileForm(initial={'first_name':server1.first_name,'last_name':server1.last_name, 'phone_no':server2.phone_no,'Emg_no':server2.Emg_no,'area_code':server2.area_code,'landline_number':server2.landline_number, 'shop_name':server2.shop_name, 'shop_address':server2.shop_address, 'country':server2.country, 'city':server2.city, 'website':server2.website})
variables = RequestContext(request,
{'group':group,'update_profile':update_profile,'timeline_list': timeline_li, 'updatepassword':ChangePasswordForm,'userimage':userimage,'image1':image1})
return render_to_response(
'registration/profile_try.html' , variables,
)
我的html就像这样
<div class="uiAvatarXLarge profileHighlightAvatar" >
<img id="user_img" alt="" class="img-rounded" src="{% static '{{image1.user_image}}' %}" style="width:120%;cursor:pointer;">
</div>
但我的图片无法正常显示。有人可以帮助我吗?
答案 0 :(得分:0)
您应该在模板中使用{{image1.user_image.url}}