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.
Thanks in advanced.
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.
Thanks in advanced.
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.
Or just create a file called sql/<modelname>.sql: http://docs.djangoproject.com/en/dev/howto/initial-data/#providing-initial-sql-data