Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Haydar Al-Rikabi
Haydar Al-Rikabi
5,971 Points

What error_css_class can do that custom form attributes can't?

Whether I use:

class MyForm(forms.Form):
    error_css_class = 'my_css_style'

or

class MyForm(forms.Form):
    my_custom_css_class = 'my_css_style'

The result is the same when I use it in my template file.

My question is what is the point of having a reserved keyword (like error_css_class) for a from attribute when we can actually use any name to achieve the same thing?

Does error_css_class save us from doing any extra work?

I've read the docs about error_css_class but I couldn't find a reply to my question there.