I checked to see if this is possible, but the documentation is not forthcoming. I also have not seen any questions which seem to address the issue.
I have a model:
class CreditCard(models.Model):
NAME = models.CharField(max_length = 55)
TYPE = models.CharField(max_length = 12)
NUMBER = models.CharField(max_length = 16, primary_key=True)
CCV2 = models.CharField(max_length = 4)
EXPMONTH = models.CharField(max_length = 2)
EXPYEAR = models.CharField(max_length=4)
**USER_ID = models.ForeignKey(User, to_field="USER_ID")**
ADDRESS = models.ForeignKey(Address, to_field="ADDRESS_ID")
The field in question is surrounded in asterisks.
I want this field to be able to reference one of two tables resembling a ForeignKey OR statement:
USER_ID = models.ForeignKey(User OR Merchant, to_field="USER_ID" OR "MERCHANT_ID")
Is this possible? If so, how is it done?