SAPAdjustment中的列acct_per_num列”包含月份号。下面的代码提供了一个带有月份数字(1,2,3)的下拉列表,但我想使用月份名称(January,February,March)。
forms.py
class SAPReconForm(forms.Form):
month = forms.ModelChoiceField(queryset=SAPAdjustment.objects.values_list('acct_per_num',flat=True).distinct(), empty_label=None)
models.py
class SAPAdjustment(models.Model):
acct_per_num = models.IntegerField( blank=True,null=True, verbose_name =_('Month'),help_text=_('Month'))
使用calendar
--(pydocs)模块生成calendar
为,
choices