Ticket #5247: patch_ticket5247_r11751.diff
File patch_ticket5247_r11751.diff, 922 bytes (added by , 15 years ago) |
---|
-
django/forms/widgets.py
579 579 final_attrs = self.build_attrs(attrs, name=name) 580 580 output = [u'<ul>'] 581 581 # Normalize to strings 582 str_values = set([force_unicode(v) for v in value]) 582 use_pk = value and hasattr(value[0], 'pk') 583 if use_pk: 584 # Assume we are using models if it's got a 'pk' attribute. 585 str_values = set([force_unicode(v.pk) for v in value]) 586 else: 587 str_values = set([force_unicode(v) for v in value]) 583 588 for i, (option_value, option_label) in enumerate(chain(self.choices, choices)): 584 589 # If an ID attribute was given, add a numeric index as a suffix, 585 590 # so that the checkboxes don't all have the same ID attribute.