'Django REST FRAMEWORK + django admin data save

I am not able to save my rest API data to my another Django Project.

How I can populate another rest API data to my Django admin database ?



Solution 1:[1]

The data is stored in the database so I assume you want to transfer data to your new database.

You can do it in the following way.

  1. First clear your new database - (here new is the name of your database, it is default but you can look it up in settings.py file and use that name)

    python manage.py flush --database=new

  2. Export data from the old Database to a json file

    python manage.py dumpdata>data.json

  3. Load Data into the new Database

    python manage.py loaddata data.json --database=new

You have the data in your new project database from your old database.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Innomight