I'm trying to make the options of a particular drop down box be
determined at runtime.

I added a __init__ constructor to my django.forms.Form subclass as
follows...

        def __init__(self,
                           data                = None,
                           error_class         =
django.forms.util.ErrorList,
                           manage_sites_domain = None):
 
"""
 
constructor
                """

                super(InputPostsForm, self).__init__(data,
                                                     error_class =
error_class)
                if manage_sites_domain:
                        domain     = manage_sites_domain
                        site       = SITE.objects.get(domain = domain)
                        categories = CATEGORY.objects.filter(site =
site)
                        choices    = [2 * (e.name,) for e in categories]
                        pc         = self.fields["post_category"]
                        pc.widget  = SELECT()
                        pc.choices = choices

I printed the choices list to verify the list contains a tuple with 2
strings.

When I view the form in a browser I see a drop down box with NO
choices.  Or rather, a blank choice.

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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