Possible Duplicate:
How can I have two foreign keys to the same model in Django?
New to Django, trying to wrap my head around how to set up this model. Basically I have a model called "Order" which lists the buyers information including one field which is takes a foreignkey(User). Not I want to add another field "seller" that relates to a different user who would be selling the order item, but django doesnt let me add another field relating to the same foreign key. What would be the proper way to set this model up? Thanks as always for your help in advance.
class Order(models.Model):
date = models.DateTimeField(auto_now_add=True)
buyer = models.ForeignKey(User, null=True)
transaction_id = models.CharField(max_length=20)
email = models.EmailField(max_length=50)
phone = models.CharField(max_length=20)
shipping_name = models.CharField(max_length=50)
shipping_address_1 = models.CharField(max_length=50)
shipping_address_2 = models.CharField(max_length=50)
shipping_city = models.CharField(max_length=50)
shipping_state = models.CharField(max_length=2)
shipping_zip = models.CharField(max_length=10)
billing_name = models.CharField(max_length=50)
billing_address_1 = models.CharField(max_length=50)
billing_address_2 = models.CharField(max_length=50, blank=True)
billing_city = models.CharField(max_length=50)
billing_state = models.CharField(max_length=2)
billing_country = models.CharField(max_length=50)
billing_zip = models.CharField(max_length=10)
def __unicode__(self):
return 'Order #' + str(self.id)