Given these models:
class Company(models.Model):
company_name = models.CharField(max_length=50, unique=True)
....
class Product(models.Model):
company = models.ForeignKey(Company)
product_name = models.CharField(max_length=100)
...
class Inventory(models.Model):
product = models.ForeignKey(Product, null=True, unique=True)
...
Importing from an XLS into Inventory with company_name and product_name properly specified, that is the XLS file contains a single row specifing the company_name and product_name for a unique Product.
The product object can be found in Django/python by::
Product.objects.filter(company__company_name=company_name, product_name=product_name)
How should the Django-import-export resources.ModelResources be constructed to support import via the admin?
In your Admin.py use this code.
for further refrence use https://django-import-export.readthedocs.org/en/latest/installation.html