投稿認証
Django の %22DO_NOTHING%22 フィルターの動作は定義されていません。 これをテンプレートまたはビューで使用すると、予期しない結果が生じる可能性があります。
.db.utils.ProgrammingError: %22DO_NOTHING%22 is not defined I'm trying to run a migration in Django, but I get the following error: <code>django.db.utils.ProgrammingError: %22DO_NOTHING%22 is not defined</code> The migration file looks like this: <code># -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-08-18 13:16 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("myapp", "0004_auto_20170818_1255")] operations = [migrations.AlterField(model_name="mymodel", name="field1", field=models.ForeignKey(null=True, on_delete=models.DO_NOTHING, related_name="+", to="myapp"))] # noqa</code> The model it's referring to looks like this (the field in question is <code>field1</code>) : <code>class MyModel(models.Model): field1 = models.... # other fields here</code> # noqa
エラーは、 DO_NOTHING
オプションが定義されていません – 使用している Django のバージョンでサポートされていない可能性があります。 これを修正するには、Django を新しいバージョンに更新するか、 on_delete
サポートされている他の何かへのオプション。
Django 'Handler' が定義されていない問題を解決する
このエラーは、Django プロジェクトに import ステートメントがないために発生します。 プロジェクトの imports セクションに次の行を追加することで、これを修正できます。
django.contrib.auth.modelsからユーザーをインポート
サードパーティの認証ライブラリを使用している場合は、そのインポートも追加する必要がある場合があります。