On Jan 11, 2008 10:39 AM, WoonZai <[EMAIL PROTECTED]> wrote:
> >>> model = create_model('Empty')
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
>   File "/Users/../models.py", line 36, in create_model
>     return type(UserForm, (models.Model,), attrs)
>   File "/.../site-packages/django/db/models/base.py", line 52, in
> __new__
>     model_module = sys.modules[new_class.__module__]

Whoops! Looks like that's my error. I'm not sure what I was smoking
when I wrote that, but you're absolutely right, that example doesn't
(and shouldn't!) work. You must always specify either a module name
that exists and is a valid Django app's models module (so Django can
determine app_label dynamically) or a custom app_label, which, if
you're using trunk, will tell Django not to bother making sure the
module exists.

I've updated the article to reflect this. Thanks for the report. For
future reference, even though the traceback you provided did help me
figure out what went wrong, it's usually best to include the actual
error message as well (in this case, KeyError: '').

-Gul

--~--~---------~--~----~------------~-------~--~----~
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