Reputation: 5377
Is there a way to run some custom SQL statements after syncdb does it thing creating the tables for the models? Specifically, I would like to create some database views.
Upvotes: 6
Views: 2520
Reputation: 3261
Note: As mentioned in the comments, this method is deprecated as of Django 1.7.
Or just create a file called sql/<modelname>.sql: http://docs.djangoproject.com/en/dev/howto/initial-data/#providing-initial-sql-data
Upvotes: 4
Reputation: 43912
Yes, there are signals you can catch after a syncdb.
See management signals for docs.
This is how the contrib.auth permissions table is populated, as well as the contenttypes framework table.
Upvotes: 9