在我的情况下,如何从数据库设置背景?
obj = UserBackground.objects.get(user=request.user)
bg = obj.image
return render_to_response('template.html', {'bg':bg}....)
模板.html:
<div class="wrapper wrapper--home" style="background: url("{{MEDIA_URL}}{{bg}}") no-repeat center top;">
</div>
样式.css:
.wrapper--home {
height: 439px;
margin: 0 auto !important;
}