Django之mako模板使用

Quincy379發表於2018-10-11
count_num = Pack.objects.all().count()
    # 當前業務映象版本多於5個,請刪除至5個以內(包含5個)
    if count_num > 5:
        context.update({'images_count_info':'當前業務映象版本多於5個,打包前請刪除至5個以內(包含5個)'})
    elif count_num <= 5:
        context.update({'images_count_info': '<div class="col-sm-12"> <input class="btn btn-primary" type="submit"  value="打包"></div>'})
    response = render_mako_context(request, '', context)
    response.set_cookie('projId', project_id)
    return response
<div style="color: red;font-size: medium">
	${images_count_info}
</div>

相關文章