Hello, I am trying to create a form with fields based on types of an object property. Basically, I am setting up a system which has hardware 'demos' which are categorized by industry. I want to create a form which has a Checkbox Select Multiple for each industry, with the choices being the demos for that industry. Currently, my (un-working) form code looks like:
class select_demo_apps_frm(forms.Form): # List apps from each industry with selection boxes for each app. def __init__(self, *args, **kwargs): super(select_demo_apps_frm, self).__init__(*args, **kwargs) inds = industries() # returns all industry objects for ind in inds: fieldname = '%s' % ind.name self.fields[fieldname] = forms.CheckboxSelectMultiple() self.fields[fieldname].choices = [(d.id, marksafe('<b>%s</ b> - %s') % (d.name, d.desc)) for d in demo.objects.filter(industry = ind)] Unfortunately, I'm getting an error from this code: Error when calling the metaclass bases Cannot create a consistent method resolution order (MRO) for bases Form, select_demo_apps_frm It could be possible to set a static field for each industry, however in the interest of long term maintainability I'd rather do it dynamically in case new industries get added after I leave this job. Just wondering if anyone can help with creating this form in such a way that it actually works ;) Thanks much! Fernando Sanchez -- 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.