Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
sqlフォルダー内のsql-fileが必要な名前はどれですか?ユーザーモデルのカスタムSQLをロードしたい場合。
初期SQLデータ
あなたが提供したリンクから:
modelnameフックは単純です。Djangoはアプリディレクトリでsql/.sqlというファイルを探すだけです。ここmodelnameで、は小文字のモデル名です。
modelname
したがって、myappというアプリにPersonモデルがある場合は、myappディレクトリ内のファイルsql/person.sqlに任意のSQLを追加できます。ファイルに含まれる可能性のあるものの例を次に示します。