Hello,

I have an application with a model similar to the following:
class Relations(models.Model):
        user1 = models.ForeignKey(User, related_name='relations_user1_set',
editable=False)
        user2 = models.ForeignKey(User, related_name='relations_user2_set',
editable=False)
        userType = models.PositiveSmallIntegerField(max_length=1,
editable=False, choices=( ('0', 'user'), ('0', robot) ))

Ok, so basically what I need this to do is that in case that the
userType is 1-robot it'll be a ForeignKey to Robot and not to User.

I'm assuming this is not possible with the current ORM implementation,
but I would be glad to hear I'm wrong.

Any suggestions? (this table serves the same purpose, and I'll most
likely always grab both robots and users so having another table for
each type is redundant and will be a problem if I append any more
choices in the future).


Thank you!
Gil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to