Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top