Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2116 -- Added ul_class parameter to CheckboxSelectMultipleFiel…

…d. Thanks, Jorge Gajon

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3110 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a88e0ec5c682e455a1b71837b9bb40ed4ace5ae2 1 parent 3aa6b05
Adrian Holovaty authored June 08, 2006

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  django/forms/__init__.py
5  django/forms/__init__.py
@@ -613,9 +613,10 @@ class CheckboxSelectMultipleField(SelectMultipleField):
613 613
     back into the single list that validators, renderers and save() expect.
614 614
     """
615 615
     requires_data_list = True
616  
-    def __init__(self, field_name, choices=None, validator_list=None):
  616
+    def __init__(self, field_name, choices=None, ul_class='', validator_list=None):
617 617
         if validator_list is None: validator_list = []
618 618
         if choices is None: choices = []
  619
+        self.ul_class = ul_class
619 620
         SelectMultipleField.__init__(self, field_name, choices, size=1, is_required=False, validator_list=validator_list)
620 621
 
621 622
     def prepare(self, new_data):
@@ -628,7 +629,7 @@ def prepare(self, new_data):
628 629
         new_data.setlist(self.field_name, data_list)
629 630
 
630 631
     def render(self, data):
631  
-        output = ['<ul>']
  632
+        output = ['<ul%s>' % (self.ul_class and ' class="%s"' % self.ul_class or '')]
632 633
         str_data_list = map(str, data) # normalize to strings
633 634
         for value, choice in self.choices:
634 635
             checked_html = ''

0 notes on commit a88e0ec

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