Hi,

I've been trying for some time to create a polymorphic link with a
backwards-link from the associated model.  The problem is the model is
django.contrib.auth.models.User...  Is there any way to add this
functionality without changing the django core?  Trying to call
setattr(django.contrib.auth.models.User, 'target',
generic.GenericRelation(MyUser) does not work.  It instantiates an
attribute named 'target', but it doesn't work in the manner
intended...

from django.contrib.auth.models import User as Account
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
class User(models.Model):
        account_polymorphic_link = models.ForeignKey(ContentType)
        account_id = models.PositiveIntegerField()
        account = generic.GenericForeignKey('account_polymorphic_link',
'account_id')

setattr(Account, 'target', generic.GenericRelation(User)) #this
doesn't seem to work

My problem is that I'm using auth.User (Account in the above example)
to store username/password and to leverage permissions and such, but I
can't look someone up by username and get at the information in my
derivative class...

Does anyone have any ideas/suggestions?

Thank you,

Alex.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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