本文整理汇总了Python中django.utils.dates.MONTHS.iteritems方法的典型用法代码示例。如果您正苦于以下问题:Python MONTHS.iteritems方法的具体用法?Python MONTHS.iteritems怎么用?Python MONTHS.iteritems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.utils.dates.MONTHS
的用法示例。
在下文中一共展示了MONTHS.iteritems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from django.utils.dates import MONTHS [as 别名]
# 或者: from django.utils.dates.MONTHS import iteritems [as 别名]
def __init__(self, *args, **kwargs):
super(StripePaymentForm, self).__init__(*args, **kwargs)
self.fields['card_cvv'].label = "Card CVC"
self.fields['card_cvv'].help_text = "Card Verification Code; see rear of card."
months = [ (m[0], u'%02d - %s' % (m[0], unicode(m[1])))
for m in sorted(MONTHS.iteritems()) ]
self.fields['card_expiry_month'].choices = months
示例2: as_dict
# 需要导入模块: from django.utils.dates import MONTHS [as 别名]
# 或者: from django.utils.dates.MONTHS import iteritems [as 别名]
def as_dict(self):
widget_dict = super(RemoteDateInput, self).as_dict()
widget_dict['input_type'] = 'date'
years = self.widget.years
if not callable(self.widget.years):
years = lambda: self.widget.years
choices = [{'key': "%02d" % i, 'value': i} for i in range(1, 32)]
day_choices = self.create_select('day', choices)
choices = [{'key': "%02d" % i, 'value': j} for (i, j) in MONTHS.iteritems()]
month_choices = self.create_select('month', choices)
choices = [{'key': "%s" % i, 'value': i} for i in years()]
year_choices = self.create_select('year', choices)
widget_dict['choices'] = [day_choices, month_choices, year_choices]
return widget_dict