Reputation: 620
Background:
I'm dealing with quite complex django application and I'm looking for a way to make my life a little bit easier.
One of the models (tables) serves as source of "options" for most "select lists" in the system (simple field <-> dictionary construct). It should always be populated with the default values and/or extenden when the there are new entries provided with a new version of the system.
I manage it all now manually so:
All of this because of default values provided in ForeignKeys.
Actual Question:
Is it possible to add table entries (table content) to the makemigrations process for particular tables??
Upvotes: 4
Views: 3529
Reputation: 599610
Yes, you can do anything you like in a migration via the RunPython operation. This is called a data migration and is fully documented.
Upvotes: 3