Django Import/Export ManyTo Many

33 views
Skip to first unread message

dtdave

unread,
Jun 21, 2017, 5:39:29 AM6/21/17
to 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!
Reply all
Reply to author
Forward
0 new messages