문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

For easier reuse I'd suggest my Django-PyFixture library. You'd then program your fixture in raw python, but it would semantically look like one more fixture.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top