... :added イベントでは、 event.target は新しく追加された行です。 カスタムの change_form.html テンプレートで admin_change_form_document_ready ブロックを拡張し、イベントリスナーのコードを追加します: {% extends 'admin/change_form.html' %} {% load static %} {% ... block admin_change_form_document_ready %} {{ block .super }} < script src = " {% static 'app/formset_handlers.js' %} " ></ script > {% endblock %} app/stat ... ic/app/formset_handlers.js ¶ document . addEventListener ( 'formset:added' , ( event ) => { if ( event . detail . formsetName == 'author_set' ) { // Do somethin ... ... :added イベントでは、 event.target は新しく追加された行です。 カスタムの change_form.html テンプレートで admin_change_form_document_ready ブロックを拡張し、イベントリスナーのコードを追加します: {% extends 'admin/change_form.html' %} {% load static %} {% ... block admin_change_form_document_ready %} {{ block .super }} < script src = " {% static 'app/formset_handlers.js' %} " ></ script > {% endblock %} app/stat ... ic/app/formset_handlers.js ¶ document . addEventListener ( 'formset:added' , ( event ) => { if ( event . detail . formsetName == 'author_set' ) { // Do somethin ... ... には非エンコード形式を渡すよう指摘する警告が発せられます。 JSONエンコードされた文字列リテラルを渡すために使われていたコード: Document . objects . bulk_create ( Document ( data = Value ( "null" )), Document ( data = Value ( "[]" )), Document ( data = Value ... ( '"foo-bar"' )), ) Document . objects . annotate ( JSONBAgg ( "field" , default = Value ( "[]" )), ) これは以下のようにすべきです: Document . objects ... . bulk_create ( Document ( data = Value ( None , JSONField ())), Document ( data = []), Document ( data = "foo-bar" ), ) Document . objects . annot ... ... には非エンコード形式を渡すよう指摘する警告が発せられます。 JSONエンコードされた文字列リテラルを渡すために使われていたコード: Document . objects . bulk_create ( Document ( data = Value ( "null" )), Document ( data = Value ( "[]" )), Document ( data = Value ... ( '"foo-bar"' )), ) Document . objects . annotate ( JSONBAgg ( "field" , default = Value ( "[]" )), ) これは以下のようにすべきです: Document . objects ... . bulk_create ( Document ( data = Value ( None , JSONField ())), Document ( data = []), Document ( data = "foo-bar" ), ) Document . objects . annot ... ... e the final Django release series to do so; beginning with Django 1.4, the minimum supported Python version will be 2.5. A document outlining our full timeline for deprecating Python 2.x and moving to Python 3.x will be published shortly after the releas ... etely generic view base class that can be used as the basis for reusable applications that can be easily extended. See the documentation on class-based generic views for more details. There is also a document to help you convert your function-based gener ... as well -- most notably, the error emails sent on an HTTP 500 server error are now handled as a logging activity. See the documentation on Django's logging interface for more details. Extended static files handling ¶ Django 1.3 ships with a new contrib ... ... e the final Django release series to do so; beginning with Django 1.4, the minimum supported Python version will be 2.5. A document outlining our full timeline for deprecating Python 2.x and moving to Python 3.x will be published shortly after the releas ... etely generic view base class that can be used as the basis for reusable applications that can be easily extended. See the documentation on class-based generic views for more details. There is also a document to help you convert your function-based gener ... as well -- most notably, the error emails sent on an HTTP 500 server error are now handled as a logging activity. See the documentation on Django's logging interface for more details. Extended static files handling ¶ Django 1.3 ships with a new contrib ... ... rve ( request , path , document_root , show_indexes = False ) ¶ プロジェクトの静的アセット以外にも、利便性のために、ローカル開発で Django に配信させたいフ ... rest of your URLconf goes here ... if settings . DEBUG : urlpatterns += [ re_path ( r "^media/(?P<path>.*)$" , serve , { "document_root" : settings . MEDIA_ROOT , }, ), ] このコードは MEDIA_URL の値が 'media/' であると仮定しています。これは serve() ビュ ... ーを呼び出して、 URLconf からのパスと、必須の document_root パラメータを渡します。 この URL パターンを定義するのは少し面倒なので、 Django には小さな URL ヘルパー関数 static() が ... ... 変更することができます。 以下のようにしてトークンを取得できます: function getCookie ( name ) { let cookieValue = null ; if ( document . cookie && document . cookie !== '' ) { const cookies = document . cookie . split ( ';' ); for ( let i = 0 ; i < cookies ... CSRF トークンを含め、JavaScript で DOM からトークンを読み取る必要があります: {% csrf_token %} < script > const csrftoken = document . querySelector ( '[name=csrfmiddlewaretoken]' ). value ; </ script > AJAX 通信でトークンを設定する ¶ 最後に、AJAXリクエス ... テンプレート リクエスト csrftoken クッキー デコレータ ミドルウェア request 送信 exempt view レスポンス views 方法 ヘッダー document decorators クイック検索 Last update: 2026年10月09日 « previous | up | next » ... ... 変更することができます。 以下のようにしてトークンを取得できます: function getCookie ( name ) { let cookieValue = null ; if ( document . cookie && document . cookie !== '' ) { const cookies = document . cookie . split ( ';' ); for ( let i = 0 ; i < cookies ... CSRF トークンを含め、JavaScript で DOM からトークンを読み取る必要があります: {% csrf_token %} < script > const csrftoken = document . querySelector ( '[name=csrfmiddlewaretoken]' ). value ; </ script > AJAX 通信でトークンを設定する ¶ 最後に、AJAXリクエス ... ... rve ( request , path , document_root , show_indexes = False ) ¶ プロジェクトの静的アセット以外にも、利便性のために、ローカル開発で Django に配信させたいフ ... rest of your URLconf goes here ... if settings . DEBUG : urlpatterns += [ re_path ( r "^media/(?P<path>.*)$" , serve , { "document_root" : settings . MEDIA_ROOT , }, ), ] このコードは MEDIA_URL の値が 'media/' であると仮定しています。これは serve() ビュ ... ーを呼び出して、 URLconf からのパスと、必須の document_root パラメータを渡します。 この URL パターンを定義するのは少し面倒なので、 Django には小さな URL ヘルパー関数 static() が ... 2026年10月08日