class Medicine(models.Model):
medicalrec = models.ForeignKey(MedicalRec,related_name='med_set')
medicine = models.ForeignKey(Stock,related_name='stock_set')
stockpk = models.IntegerField()
class MedicalRec(models.Model):
patient = models.ForeignKey(Patient)
date = models.DateField()
disease = models.TextField()
treatment = models.TextField()
billed = models.BooleanField()
我正在尝试访问medrec或n的外键pk。但不是真正的PK,而是每次都显示1,2,3 ...... n.medicine.id给1,2,3 ...而不是真正的3,4,5是否有解决方法呢?
class MyException(Exception):
def __init__(self, arg):
pass
raise MyException