-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Name' attribute does not override built in 'name' attribute #110
Comments
I think this is just a limitation of Django's widget implementation. The There are also a few questions on StackOverflow about this topic, e.g.:
However, just out of curiosity: What is your use case for this? Why not simply changing the name in the form itself? Keep in mind that you won't be able to submit the input field with the new name, since the form expects the original name in response. |
@timoludwig
I was just watching one tutorial and the guy was overriding the field names and labels left and write using bootstrap4 Django package. So, although this was a
Which is pretty bad coding practice if you ask me, but the curiosity got the best of me (well, actually in this case - the worst of me) and I wondered if I could do something similar using crispy-forms and widget-tweaks. |
Well, but that's a totally different question 😅 The recommended way of changing the label is in the field definition of the form class rather than in the html code, but of course you can just write:
and the placeholder can e.g. be customized via the
as mentioned in the README. I don't know anything about crispy-forms, but at first sight I think it serves a similar purpose like widget-tweaks, so I don't see a reason to use both at the same time. |
I have the following code in the Django template:
but when I inspect the element in the Chrome Dev Tools I can see that the element still has the default
username
attribute.I'm trying to change this attribute so that the label for this field should read
Email
.How can I change the name attribute from
username
toemail
?The text was updated successfully, but these errors were encountered: