0
我有2個表如下: -Django管理外鍵
class Package(models.Model):
'''Model to represent details of the packae booking'''
date_of_inquiry = models.DateField(blank=True, null=True)
agent_name = models.CharField(max_length=200, blank=True)
type_of_booking = models.ForeignKey(TypeOfBooking, blank=True, null=True)
no_of_pax = models.IntegerField(null=True)
source_of_inquiry = models.CharField(max_length=100, blank=True)
business_vendor = models.CharField(max_length=100, blank=True)
travel_date = models.DateField(null=True, blank=True)
reply_date = models.DateField(null=True, blank=True)
client_name = models.CharField(max_length=500, blank=True)
client_email = models.EmailField(blank=True)
client_contacts = models.CharField(max_length=200, blank=True)
inquiry_assigned_to = models.ForeignKey(User, blank=True, null=True)
def __unicode__(self):
return str(self.date_of_inquiry) + " " + self.client_name
class FollowUp(models.Model):
'''Model to represent follow-ups of the clients'''
follow_up_date = models.DateField(blank=True, null=True)
remarks = models.TextField(max_length=500, blank=True)
package = models.ForeignKey(Package, blank=True, null=True)
status_inquiry = models.ForeignKey(StatusInquiry, blank=True, null=True)
followup_done_by = models.ForeignKey(User, blank=True, null=True)
def __unicode__(self):
return str(self.follow_up_date) + " " + self.status_inquiry.status_name
我要訪問的包在管理面板中有下列屬性中顯示一個列表視圖: -
list_display( 'AGENT_NAME',' date_of_inquiry',##########) 注意:##############字段應該是同一包的最近跟進狀態。
這怎麼能實現?將感謝您的答案。
謝謝,幫助:-) –