On Sun, 2007-05-20 at 21:32 +0200, Marek Kubica wrote:
> Hi all!
> 
> I've got a normal model and I would like to add additional functionality
> via a mixin-class. This works quite well, until I tried to modify some of
> the attributes of the model from my mixin.
> 
> I've got two fields which both fail to be set, but in different ways:
>  - setting 'objects' to a custon manager from the mixin does not work at
>    all: the class carries on having the dafault manager. I think this is
>    because of some code in Django that adds a default manager without
>    caring whether there was already one or not.
>  - adding a database-field like position = models.Integerfield() seems to
>    work (at least the attribute is in the right place) but unfortunately
>    manage.py sql (and syncdb probably as well) does not find the
>    mixin-injected field.
> 
> Have you any ideas on how to accomplish this?

You're probably going to have to look at the ModelBase.__new__ method
and work in nicely with that as well. Django's model creation metaclass
stuff is fairly key to how things work.

You might want to read the DevModelCreation wiki page for more
information.

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