I finally realized that simply inheriting a model will not work like I
expected.  For example:

from django.core import validators
from django.contrib.auth.models import User as OldUser
from django.db import models

class User(OldUser):
    def __init__(self, *args, **kwargs):
        super(User, self).__init__(*args, **kwargs)

    username = models.CharField(
        _('username'), blank=True, maxlength=30, unique=False, \
        validator_list=[validators.isAlphaNumeric], \
        help_text=_("Required. 30 characters or fewer. Alphanumeric "\
                    "characters only (letters, digits and
underscores)."))

    email = models.EmailField(_('e-mail address'), blank=False,
unique=True)

    # additional fields, etc.

    class Admin:
        pass

class Event(models.Model):
    def __str__(self):
        return self.name

    name = models.CharField(maxlength=100, blank=False)
    attendants = models.ManyToManyField(User)
    description = models.TextField()

    class Admin:
        pass

This will create a new mysite_user table and mysite_event_attendants
will refer to the correct foreign tables.  However, under the /admin
site, the 'event' object still refer to 'auth_user' instead of
'mysite_user', and this will cause an error whenever you add/change/
delete.

Does that means the best I can do is to use 'auth' and 'admin' apps as
a simple admin backend, and build my own models/admin apps?

-- John

On Mar 27, 8:31 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2007-03-26 at 16:25 +0000, John Lee wrote:
>
> You cannot override an existing class. In this case, you are going to
> have to change the existing Django model. Sorry about that.
>
> Regards,
> Malcolm


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