Sorry seems I sent this reply to John and not the group.
---------- Forwarded message ----------
From: Steven Osborn <osborn...@gmail.com
Date: Wed, Apr 15, 2009 at 11:27 PM
Subject: Re: [tulsapython] Why doesn't this work?
To: John Dungan <johna...@gmail.com
From Django Docs: >>>
If you provide form_class, it should be a django.forms.ModelForm
subclass. Use this argument when you need to customize the model's
form. See the ModelForm docs for more information.
Otherwise, model should be a Django model class and the form used will
be a standard ModelForm for model.
objects of ModelForm or Model type will have a _meta attribute.
I would use an if - else to determine what type of object your creating like:
from myapp.models import Foo, Bar
if "foo" in request.POST.get('foo_type'):
foo_type = Foo; # I don't think Django is expecting an instance
here but if so you'll want to do Foo()
else "bar" in request.POST.get('foo_type'):
foo_type = Bar;
You could use eval() to turn the string into an object but that is a
terrible idea if your app is ever going to be used by anyone besides
Hope this helps.