python - Saving django test database in a fixture? -


I have a production database that contains a large set of data I want to use some data to run the unit test But to create the database, all the reasons for the beginning of the testing process take a very long time, which I would like to save.

I have created a test database using the manage.py investigator command, then deleted all the data that I did not want to include through the administrator interface. How do I create a stability of data in the default test database?

You dumpetta to generate Jason stability, like this:

./down.py dump diagram & gt; Fixture.json

If you want to save stability from your testing, then just serialize your qs:

  #definfo Import your models from Core serializers import serialize qs1 = Model1.objects.filter (...) qs2 = Model2.objects.filter (...) ... fiction = 'sicalize' ('jason', list (qs1) + list (qs2) + F: f.write (stability)  
as the open ('stability. Jason', 'W') with the list (...)

Comments