Skip to content
Advertisement

Django forms: not adding attributes

I’m aware that there is many post like this, but can you spot the typo or error in my code?

I’m adding custom classes to my forms but when I inspect the element on the web page there are none. The same goes for placeholder.

Code:

Views.py:

JavaScript

Template file:

JavaScript

Forms.py:

JavaScript

Advertisement

Answer

I think, you already specified the fields name and surname in the class itself, so you should use inline widgets not Meta widgets, as they are used for overriding default widgets, so:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement