django 我想更改登录表单的标签

hwazgwia  于 2023-08-08  发布在  Go
关注(0)|答案(1)|浏览(113)

我想更改登录表单的标签,但这不会发生。运行时,这些标签显示它们的默认状态,“登录”和“密码”。谢谢你的指导

from django import forms
from django.contrib.auth.models import User
from .models import Profile

class LoginForm(forms.Form):
    username = forms.CharField(label='نام کاربری')
    password = forms.CharField(widget=forms.PasswordInput, label='پسورد')

字符串
标签的自定义更改

ukqbszuj

ukqbszuj1#

您的代码中有一个错别字。你把label拼错为lable,请像下面这样更新你的代码:

from django import forms
from django.contrib.auth.models import User
from .models import Profile

class LoginForm(forms.Form):
    username = forms.CharField(label='نام کاربری')  # Corrected "label" spelling
    password = forms.CharField(widget=forms.PasswordInput, label='پسورد')  # Corrected "label" spelling

字符串

相关问题