S
S
Sergey Ganzhela2017-02-10 11:45:34
PostgreSQL
Sergey Ganzhela, 2017-02-10 11:45:34

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

2 answer(s)
S
Sergey Ganzhela, 2017-02-10
@Sergiy_Hanzhela

I’ll answer myself, I had to do dumps for each app and load one at a time, everything passed!

P
Peter, 2017-02-10
@petermzg

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}}
]

So dump is clearly not suitable here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question