Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed #13037 -- Added documentation for the css_classes() helper clas…

…s. Thanks to marcusf for the report.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e081160706cc7ac7943752632049a6dbe420bc6f 1 parent 255b3a9
@freakboy3742 freakboy3742 authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 docs/ref/forms/api.txt
19 docs/ref/forms/api.txt
@@ -645,6 +645,25 @@ when printed::
>>> str(f['subject'].errors)
+.. versionadded:: 1.2
+When you use Django's rendering shortcuts, CSS classes are used to
+indicate required form fields or fields that contain errors. If you're
+manually rendering a form, you can access these CSS classes using the
+``css_classes`` method::
+ >>> f = ContactForm(data)
+ >>> f['message'].css_classes()
+ 'required'
+If you want to provide some additional classes in addition to the
+error and required classes that may be required, you can provide
+those classes as an argument::
+ >>> f = ContactForm(data)
+ >>> f['message'].css_classes('foo bar')
+ 'foo bar required'
.. _binding-uploaded-files:
Binding uploaded files to a form

0 comments on commit e081160

Please sign in to comment.
Something went wrong with that request. Please try again.