4👍
✅
Okay, I figured it out. Listing all properties of a form by:
form = SignUpForm()
for d in dir(form):
print(d)
I found, by trials and errors, that you can list fields of the form:
form = SignUpForm()
for d in form.fields:
print('field name:', d)
print('field label:', form.fields[d].label)
print('field text:', form.fields[d].help_text)
print("")
returns:
field name: username
field label: Username
field text: Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
field name: display_name
field label: None
field text: Your display name
field name: password1
field label: Password
field text: <ul><li>Your password can't be too similar to your other personal information.</li><li>Your password mus
t contain at least 8 characters.</li><li>Your password can't be a commonly used password.</li><li>Your password can&
#39;t be entirely numeric.</li></ul>
field name: password2
field label: Password confirmation
field text: Enter the same password as before, for verification.
I can easily alter those fields by writting:
x = form.fields['username']
x.label = "foo"
x.help_text = "bar"
and I got:
Source:stackexchange.com