Django: Csv Model Import
I need a way to import a cvs of data into my database. the csv matches one of my models in terms of fields. in Django are there any recommend ways/packages for doing something like
Solution 1:
If it's simple, just follow this example for reading lines of CSV:
http://docs.python.org/2/library/csv.html
And on each loop construct your model and save it. It's the quickest and easiest way of doing what you want to do. About 10 lines and not using any fancy libraries. No need to over-think it.
Solution 2:
You can have a look at django-adaptors and use a CsvDBModel.
The doc gives some hint about it here
Post a Comment for "Django: Csv Model Import"