我有以下型号:
class Doctor(models.Model):
#some attributes...
class Meta:
verbose_name = _(u'doctor')
verbose_name_plural = _(u'doctors')
class Patient(models.Model):
#some attributes...
medical_consult = models.ManyToManyField(Doctor)
class Meta:
verbose_name = _('patient')
verbose_name_plural = _('patients')
有没有办法将verbose_name
设置为使用ManyToManyField时自动创建的模型Patient_doctor
?
答案 0 :(得分:0)
medical_consult = models.ManyToManyField(Doctor, through='PatientDoctor')
# ...
class PatientDoctor(models.Model):
patient = models.ForeignKey(Patient)
doctor = models.ForeignKey(Doctor)
# ...
class Meta:
verbose_name = _('patient_doctor')
# ...