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)
...
Import from XLS to Inventory with the corresponding company_name and product_name, that is, the XLS file contains one line indicating company_name and product_name for a unique product.
The product object can be found in Django / python:
Product.objects.filter(company__company_name=company_name, product_name=product_name)
How should Django.ModelResources import-export resources be created to support import through the administrator?
source
share