I am still using 0.91, and have a question about this Model Inheritance issue in the current trunk.  We use model inheritance in our code, but in a specialized way: only the derived classes are used concretely.  The base classes are all abstract: there are no rows in their tables, no objects are ever instantiated, and no queries are made for the base classes.  We do this to build common sets of fields that are available on a number of different objects, which can then be used polymorphically with Python duck-typing.

Is this style of model inheritance still possible on the current trunk?

--Ned.

[EMAIL PROTECTED] wrote:
Hi,

Joseph Kocherhans wrote:
  
I was just about to ask the same question: I need to add some fields to
the User model and the only way I see is actually changing the auth
app.  Is that so, or did I miss something?
      
I'd recommend using the approach outlined here:
http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model
    

thanks for the URL, I did not see this page previously.

The approach works, but I want to use Django's admin interface to let
administrators edit that additional data as well.  I can use ForeignKey
limited to one item for that, but then I have to specify some of
additional fields as core and thus required.  This just does not work
too well with the data I need to put there.

So, for me patching contrib.auth still looks like the best way to add
that data.  Perhaps, since that seems to be a very common need, it
would be possible to add a generic way to plug additional fields into
the User model.  Like, say, a metaclass just for auth.User that would
check settings and patch the User attributes (field list, Admin and
Meta contents) before passing control back to ModelBase.  That looks
doable, but I have yet to find a nice and clean way to specify those
changes in project settings.  Or some more appropriate place.

That said, changing the contrib.auth code does not sound too scary to
me and might as well require the least effort to maintain.

Thanks again,
-mk






  

-- 
Ned Batchelder, http://nedbatchelder.com

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

Reply via email to