[Django] ModelからCreate Table文を作成
- November 2nd, 2009
- Posted in Python
- Write comment
def create_table(self, model):
from django.db import connection, transaction, models
from django.core.management.color import no_style
cursor = connection.cursor()
sql, references = connection.creation.sql_create_model(model, no_style())
for statement in sql:
cursor.execute(statement)
Popularity: 2% [?]
No comments yet.