Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django fixture in csv

For a Django test I'd like to load a fixture, which is in a csv file. What is the best way to do that?

like image 419
Szymon Lipiński Avatar asked Feb 19 '23 21:02

Szymon Lipiński


1 Answers

Django's built-in fixtures functionality doesn't support CSV. You'd need to process the file automatically using the csv module, probably in the test's setUp method.

like image 200
Daniel Roseman Avatar answered Feb 27 '23 10:02

Daniel Roseman