I’m working on my first Django project and I have hit a wall on trying to import data into an application.
My model is (roughly)
- Vendor
- contract (pk is in Vendor)
- pricelist items (several rows of items - pk is in contract)
- contract (pk is in Vendor)
My goal is to have a form field in the admin that allows me to upload a csv file (formatted to follow the pricelist model) and overwrite the content of that model in relation to the pk in the contract model. In the admin I have set up the form for creating a vendor, contract and have manual input of pricelist items - however I can’t figure out how to populate the pricelist items from a csv file.
What would be the easiest (and hopefully correct way) of going about that?
I have looked at the django-adaptors project, but honestly the documentation for that doesn’t make much sense (I think), and I have look on quite a few github project hoping to find a similar project I could be inspired by