Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16308 closed Uncategorized (worksforme)

CheckboxSelectMultiple can not show the data on the view — at Version 1

Reported by: jekyllhy3@… Owned by: nobody
Component: Forms Version: 1.3
Severity: Normal Keywords: Checkbox Select Multiple
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Julien Phalip)

CheckboxSelectMultiple can not show the data on the view.

when the form use CheckboxSelectMultiple, it can not show the data on view.

problem code :

class CheckboxSelectMultiple(SelectMultiple):
    def render(self, name, value, attrs=None, choices=()):
        if value is None: value = []
        has_id = attrs and 'id' in attrs
        final_attrs = self.build_attrs(attrs, name=name)
        output = [u'<ul>']
        # Normalize to strings
        str_values = set([force_unicode(v) for v in value])

solution:

 str_values = set([force_unicode(v) for v in '''eval'''(value)])

Change History (2)

comment:1 by Julien Phalip, 13 years ago

Description: modified (diff)
Resolution: needsinfo
Status: newclosed

I've reformatted your description -- next time please use preview to make sure your code samples display correctly.

Using eval() is potentially dangerous as maliciously code could get executed. It is unclear what problem you're having. Please reopen this ticket if you can provide a clear example or a test case illustrating the problem that you're trying to solve.

by jekyllhy3@…, 13 years ago

Attachment: multipleselect.zip added
Note: See TracTickets for help on using tickets.
Back to Top