Thursday, September 30, 2010

Re: Can you make a subclass of a model just to alter behavior?

On Fri, Oct 1, 2010 at 2:57 AM, orokusaki <flashdesignpro@gmail.com> wrote:
> I'm looking to do the opposite of what Django's proxy model does. I
> want to subclass Model, add some extra methods to it, add behavior to
> save(), set a default manager that adds some my-application-specific
> methods, and then subclass that to create most of the models in my
> application. Is this possible?

Sounds like you're asking for an abstract base class. Set
abstract=True instead of proxy=True; only the subclasses will be
instantiated as full Django models, but they will inherit all the
methods, managers and fields of their parent.

Yours,
Russ Magee %-)

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment