I have two classes
class A(models.Model):
id=models.IntegerField(primary_key=True)
name=models.CharField(max_length=200)
store_id=models.IntegerField()
type=models.ForeignKey(B)
class B(models.Model):
id=models.IntegerField(primary_key=True)
type=models.CharField(max_length=10)
class C(models.Model):
id=models.IntegerField(primary_key=True)
store=models.CharField(max_length=200)
class D(models.Model):
id=models.IntegerField(primary_key=True)
type=models.CharField(max_length=10)
In my class A
type
is a ForeignKey on B and store_id is a logical foreign key on C or D depending upon the value of type
.
In my field set I want to show the value of store
depending upon *type*after some calculations. The type
tells me about the table i.e C
Or D
and the vlaue of store tell me the row in that table c
or d
.Now i only want to show the value on the browser without overwriting the values.Is this possible?