django-seed | : seedling : Seed your Django database with fake data | Mock library
kandi X-RAY | django-seed Summary
kandi X-RAY | django-seed Summary
:seedling: Seed your Django database with fake data
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handles an app configuration
- Returns a mapping of models to their dependencies
- Add an entity to the queue
- Return a list of models
- Find the version string from the version file
django-seed Key Features
django-seed Examples and Code Snippets
Community Discussions
Trending Discussions on django-seed
QUESTION
So I've looked at the documentation, as well as this SO question, and the django-seed package, but none of these seem to fit what I'm trying to do.
Basically, I want to programmatically seed my Games
model from an external API, but all the information I can find seems to be reliant on generating a fixture first, which seems like an unnecessary step.
For example, in Ruby/Rails you can write directly to seed.rb
and seed the database in anyway that's desired.
If a similar functionality available in Django, or do I need to generate the fixture first from the API, and then import it?
...ANSWER
Answered 2017-Nov-14 at 22:57Would it work for you to write some class method on the Games
model that creates the data? Presumably this method query the external API, package up the Games()
objects as a list called games
and then use a Games.objects.bulk_create(games)
to insert it into the database.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-seed
You can use django-seed like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page