Answer the question
In order to leave comments, you need to log in
How to create and load fixtures correctly?
Good afternoon! Please tell me how to do it right and then load fixtures if Postgresql is used as a database, something like normal dumpdata and loaddata doesn’t work, can there be any special features? Django 1.10 post 9.5
Answer the question
In order to leave comments, you need to log in
I’ll answer myself, I had to do dumps for each app and load one at a time, everything passed!
So fixtures is a json file (initial_data.json) that contains django models and data for them.
Type:
[
{"pk": 1, "model": "diaryapp.Lang",
"fields": {"code": "ru",
"name": "\u0420\u0443\u0441\u0441\u043a\u0438\u0439",
"isuser": true}},
{"pk": 2, "model": "diaryapp.Lang",
"fields": {"code": "en",
"name": "English",
"isuser": true}}
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question