I'm new to Django and want to express a self-referencing design
feature to link clients in the same table with each other. Django is
currently objecting to this. Could you please point me to
documentation which will let me figure it out?
This is my models.py in a play project using Django from svn rev ...
- - - - - - - - - - -
from django.db import models
def when():
return datetime.now()
class Client(models.Model):
""" base class for everyone/thing """
surname = models.CharField(max_length=48, blank=False)
client_type = models.CharField(max_length=24, blank=False)
def __unicode__(self):
return self.client_type + ": " + self.surname
class Membership(models.Model):
""" cross (xr) referencing and linking clients """
client_x = models.ForeignKey(Client)
client_r = models.ForeignKey(Client)
def __unicode__(self):
return str(self.client_x + " : " + str(self.client_r)
- - - - - - - - - - -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---