iT邦幫忙

1

django crispy|form如何修改預設的字

https://ithelp.ithome.com.tw/upload/images/20210512/20136728ZdVCRDBw8O.png
我用crispy form的方式做出這樣的一個帳號密碼的登入介面,但是我應該怎麼做才能將上面的Username跟Password改成中文的帳號跟密碼?

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
froce
iT邦大師 1 級 ‧ 2021-05-13 08:00:05

這是官網的範例
你應該有像這樣的一個class。

class ExampleForm(forms.Form):
    like_website = forms.TypedChoiceField(
        label = "Do you like this website?",
        choices = ((1, "Yes"), (0, "No")),
        coerce = lambda x: bool(int(x)),
        widget = forms.RadioSelect,
        initial = '1',
        required = True,
    )

    favorite_food = forms.CharField(
        label = "What is your favorite food?",
        max_length = 80,
        required = True,
    )

    favorite_color = forms.CharField(
        label = "What is your favorite color?",
        max_length = 80,
        required = True,
    )

    favorite_number = forms.IntegerField(
        label = "Favorite number",
        required = False,
    )

    notes = forms.CharField(
        label = "Additional notes or feedback",
        required = False,
    )

label就是你要的。

好的謝謝你,我有改成功了

我要發表回答

立即登入回答