Django Import/Export ManyTo Many

ยอดดู 37 ครั้ง
ข้ามไปที่ข้อความที่ยังไม่อ่านรายการแรก

dtdave

ยังไม่อ่าน,
21 มิ.ย. 2560 05:39:2921/6/60
ถึง Django users
I have a model with a manytomany field as follows:
 
  contact = ChainedManyToManyField(
        'contacts.Contact',
        chained_field="practice",
        chained_model_field="practice",
    )

Within my admin I have the following for import/export:

contact = fields.Field(column_name='contact name', attribute='contact',
                           widget=ManyToManyWidget(Contact, 'contact'))

However, this only returns the contact id.
I am stuck on how I could return the name of the contact instead. Within the contact model contact equates to the name of the contact.

Any assistance would be appreciated and apologies in advance if I have overlooked the obvious!
ตอบทุกคน
ตอบกลับผู้สร้าง
ส่งต่อ
ข้อความใหม่ 0 รายการ