In my "products" app:

models.py
========

class ModelA(models.Model):
    ...

class ModelB(models.Model):
    ...

class ModelC(models.Model):
    ...
...
class ModelAForm(ModelForm):
    class Meta:
        model = ModelA

class ModelBForm(ModelForm):
    class Meta:
        model = ModelB

class ModelCForm(ModelForm):
    class Meta:
        model = ModelC
...


views.py
======
def model_form(request, model_name):
    form_class = __import__('products.models.%sForm'%model_name)
    form = form_class()
    ...

model_name is a string

In my view, it doesn't work. I got "ImportError"

ImportError...
No module named ModelAForm

Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to