title: Django-import-export problem importing foreignkey field
body: <p>I am using the Django-import-export(version 2.5.0) module in Django(version 3.1.4). So I am able to import all my models fields except for the ForeignKey field. I don't know how to make this one work. Can you look at my code and see what is wrong or needs to change? I need Django Admin to import the ForeignKey field.</p>
  <p>models.py</p>
  <pre><code># myapp
  from django.db import models
  from django.contrib.auth.models import User 
  
  class Agency(models.Model):
      system_name = models.CharField(max_length=255)
      county = models.CharField(max_length=60)
      state = models.CharField(max_length=2)
      active = models.BooleanField(default=True)
      system_no = models.CharField(max_length=7, unique=True)
      
      def __str__(self):
          return self.system_no
      
  class SitePart(models.Model):
      # I tried changing the &quot;system_no&quot; to another name &quot;agency_no&quot; through out the *.py's this did not resolve the problem. Maybe I missed something.
      system_no = models.ForeignKey('Agency', on_delete=models.CASCADE, to_field='system_no', null=True, blank=True)
      part_name = models.CharField(max_length=125) 
      status_tuple = [('AB','Abandoned'),('AC','Active Compliant'),('DS','Destroyed'),('IA','Inactive'),
              ('SB','Stand By waiting acitvation'),('MO','Monitoring')]
      status = models.CharField(max_length=2, choices=status_tuple, default= 'SB')
      # sys_site_n is unique
      sys_site_n = models.CharField(max_length=15, unique=True)
  
      def __str__(self):
          return self.part_name
  </code></pre>
  <p>resources.py</p>
  <pre><code>from import_export import fields, resources, widgets
  from import_export.widgets import ForeignKeyWidget
  from myapp.models import Agency, SitePart
   
  class AgencyResource(resources.ModelResource):
      class Meta:
          model = Agency
          import_id_fields = ('system_no',)
          fields = ('system_name', 'county', 'state', 'active', 'system_no',)
          
  
  class SitePartResource(resources.ModelResource):
      system_no = fields.Field(
          column_name='system_no',
          attribute='system_no',
          widget=ForeignKeyWidget(Agency,'system_no'))
      print(system_no)    
      
      class Meta:
          model = SitePart
          import_id_fields = ('sys_site_n',)
          fields = ('system_no','part_name','status', 'sys_site_n',)
  </code></pre>
  <p>admin.py</p>
  <pre><code>from django.contrib import admin
  from import_export.admin import ImportExportModelAdmin
  from myapp.resources import AgencyResource, SitePartResource
  from myapp.models import (Agency, County, SitePart)
  
  class AgencyAdmin(ImportExportModelAdmin):
      resource_class = AgencyResource
      list_display = ('system_name', 'county', 'state', 'active', 'system_no',)
  
  class SitePartAdmin(ImportExportModelAdmin):
      list_display = ('system_no', 'part_name', 'status', 'sys_site_n',)
      search_fields = ['system_no',] # Tried removing this, didn't work
      resource_class = SitePartResource
  
  admin.site.register(Agency, AgencyAdmin)
  admin.site.register(County)
  admin.site.register(SitePart, SitePartAdmin)
  </code></pre>
  <p>Agency Table</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>system_name</th>
  <th>county</th>
  <th>state</th>
  <th>active</th>
  <th>system_no</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>MAGNA SCHOOL</td>
  <td>INYO</td>
  <td>CA</td>
  <td>1</td>
  <td>1300553</td>
  </tr>
  <tr>
  <td>PINE SCHOOL</td>
  <td>INYO</td>
  <td>CA</td>
  <td>1</td>
  <td>1300560</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>SitePart Table</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>system_no</th>
  <th>part_name</th>
  <th>status</th>
  <th>sys_site_n</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1300553</td>
  <td>MAGNA SCHOOL</td>
  <td>AC</td>
  <td>1300553-01</td>
  </tr>
  <tr>
  <td>1300553</td>
  <td>Backup Genrtor</td>
  <td>SB</td>
  <td>1300553-02</td>
  </tr>
  <tr>
  <td>1300560</td>
  <td>PINE SCHOOL</td>
  <td>AC</td>
  <td>1300560-01</td>
  </tr>
  <tr>
  <td>1300560</td>
  <td>Backup Genrtor</td>
  <td>SB</td>
  <td>1300560-02</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>When I do import in django admin the system_no is empty.
  <a href="https://i.stack.imgur.com/oINUe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oINUe.jpg" alt="enter image description here" /></a></p>