开发者

Localization don't work on a ModelForm in Django

def Person开发者_运维知识库(models.Model)
       name = models.CharField(max_length=50)
       birth_date = models.DateField()

and I have this form

def PersonForm(forms.ModelForm)

   class Meta:
      model = Person

I have to localize the project to spanish (es), and add a customized format module (FORMAT_MODULE_PATH) to set DATE_FORMAT = 'd/m/Y'. Everything works fine if I only show dates in the template, but when the form is diplayed with data from the database, the input control show the date as Y-m-d

How can I fix that?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜