On Tue, Aug 30, 2005 at 09:56:42AM -0500, Adrian Holovaty wrote:
> Yeah, whoever created that wiki page did it before the model syntax
> changed. Here's an official example of subclassing models:
> 
> http://www.djangoproject.com/documentation/models/subclassing/

I have seen that already, but it did not helped me. :(

> To replace a model that's already been defined, subclass the model to
> add/remove fields, and use "replaces_module" META option, like so:
> 
>     replaces_module = 'auth.users'
> 
> This particular feature is undocumented at this point because it's
> quite advanced.

Is this idea so non-trivial?

I make app for my project, then place into myproject/apps/myapp/models/myapp.py
the following:

from django.core import meta, validators
from django.models import core, auth

class User(auth.User):
    jabber = meta.CharField(maxlength=35, blank=True)
    class META:
        replaces_module = 'auth.users'
        admin = meta.Admin(
            ('Extra info', {'fields': ('jabber', )}),
        )

And getting the traceback like:

...
  File 
"/usr/lib/python2.3/site-packages/django-1.0.0-py2.3.egg/django/core/management.py",
 line 51, in get_sql_create
    for klass in mod._MODELS:
AttributeError: 'module' object has no attribute '_MODELS'

What is the mistake here? And what should be specified as
module_name variable?

Thank you.


-- 
    Igor Goryachieff
    Jabber: [EMAIL PROTECTED]
    http://goryachev.org/

Reply via email to