I have a MultiWidget class shown below that combines a selec and
textfield widget. I want to return only the value of the textinput
though. I have done a lot of Googling and have the compress-decompress
methods competely confused in my head so my question is "How does one
create a multiwidget and return only the value from one of the widgets
it contains?"
Any help will be greatly appreciated,
Rob

class Suggester(widgets.MultiWidget):
    CHANGE_CODE = """
    ... nothing useful here...
    """

    def __init__(self, attrs=None):
        def tag_choices():
            from django.db import connection
            cursor = connection.cursor()
            cursor.execute(""")
            tag_list = cursor.fetchall()
            return tag_list

        TAG_LIST = tag_choices()
        widget_list = (widgets.TextInput(attrs=attrs),widgets.Select
(choices=TAG_LIST))
        super(Suggester, self).__init__(widget_list,attrs)

    def render(self, name, value, attrs=None):
        output = super(Suggester, self).render(name, value, attrs)
        return output + mark_safe(self.CHANGE_CODE % (name,name))

    def decompress(self, value):
        return value

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to