【发布时间】:2012-11-30 23:25:21
【问题描述】:
我使用此代码打印月份。 在 views.py
中currentMonth = datetime.now().month return render_to_response('showroom.html',{'currentMonth':currentMonth,} , context_instance=RequestContext(request))
然后打印我们文件中的变量{{currentMonth}}。 显示 12,但我想显示 12 月。
【问题讨论】:
-
当我使用 import datetime currentMonth = datetime.now().month currentMonthn = currentMonth.strftime("%B") 它通过 error 'int'对象没有属性'strftime'
标签: python templates django-templates