... トオブジェクトを引数として取り、コンテキストにマージされるアイテムの dict を返します。 デフォルトは空のリストです。 詳しくは RequestContext を参照してください。 debug はテンプレートのデバッグモードのオン/オフを切り替える真偽値です。もし True なら、テンプレートエ ... value" self . assertEqual ( c1 . flatten (), { "True" : True , "None" : None , "False" : False , "update" : "value" , }, ) RequestContext を使う class RequestContext ( request , dict_ = None , processors = None , use_l10n = None , use_tz = None , autoescape = ... True ) [ソース] Django には特別な Context クラスである django.template.RequestContext があり、通常の django.template.Context とは少し異なります。最初の違いは、 HttpRequest を最初の引数として取ることです。たと ... ... 動的生成のメニューです。一見、共通のディクショナリをテンプレートコンテキストに入れておくのが合理的に見えます。 Django では、 RequestContext を使うのが一番の方法です。詳しくはコンテキストのサブクラス RequestContext を使う を参照してください。 ... ... 脆弱性の原因となります。 対応するビュー関数では、 {% csrf_token %} が正しく機能するように、レスポンスをレンダリングする際に RequestContext が使用されていることを確認してください。 render() 関数、ジェネリックビュー、または contrib アプリを使用している場合は、これ ... らはすべて RequestContext を使用しているため、すでに対応しています。 AJAXでCSRF保護を利用する 上記の方法は AJAX の POST でも利用可能ですが、多少不便 ... ... ザ名による混乱を防ぐために、このフォームでは大文字小文字が異なるだけのユーザ名は使用できません。 テンプレート内の認証データ RequestContext を使うと、現在ログインしているユーザとパーミッションを テンプレート コンテキスト 内で使えるようにできます。 技術的には 技術 ... 的には、これらの変数は RequestContext を使い、 'django.contrib.auth.context_processors.auth' コンテキストプロセッサを有効にしたときのみ使うことができます。これは ... 、デフォルトで生成される設定ファイル内にあります。より詳しくは RequestContext のドキュメント を参照してください。 ユーザ テンプレート RequestContext をレンダリングするとき、現在ログイン中のユーザ ( Us ... ... aused a regression ( #24836 ). Fixed a regression which caused template context processors to overwrite variables set on a RequestContext after it's created ( #24847 ). Prevented the loss of null / not null column properties during field renaming of MySQL data ... ... _app parameter to set an URL namespace in Django 1.10: django.shortcuts.render() django.template.Context() django.template.RequestContext() django.template.response.TemplateResponse() Set request.current_app instead, where request is the first argument to thes ... e functions or classes. If you're using a plain Context , use a RequestContext instead. dictionary and context_instance arguments of rendering functions The following functions will no longer accept th ... eeded. If you're passing a Context in context_instance , pass a dict in the context parameter instead. If you're passing a RequestContext , pass the request separately in the request parameter. dirs argument of template-finding functions The following function ... ... ります: 404 ビューは、 Django が URLconf 内の正規表現を全てチェックしてもマッチしない場合にも呼び出されます。 404 ビューには RequestContext が渡され、テンプレートコンテキストプロセッサが提供する変数 (たとえば MEDIA_URL ) にアクセスできます。 もし DEBUG が True に ... ... くつかのメタデータを保持します。これはテンプレートをレンダリングするために Template.render() に渡されます。 django.template.RequestContext は Context のサブクラスで、現在の HttpRequest を保存し、テンプレートコンテキストプロセッサを実行します。 共通 API には等価 ... トオブジェクトを引数として取り、コンテキストにマージされるアイテムの dict を返します。 デフォルトは空のリストです。 詳しくは RequestContext を参照してください。 'debug' : テンプレートのデバッグモードのオン/オフを切り替える真偽値です。もし True なら、テンプレート ... ... ml テンプレートを読み込みます。 このテンプレートにはコンテキスト変数 flatpage が渡されます。テンプレートのレンダリングには RequestContext を使用します。 ミドルウェアは結果のURLが有効なフラットページを参照している場合にのみ、末尾のスラッシュを追加してリダイレク ... ... endif %} > {{ message }} </ li > {% endfor %} </ ul > {% endif %} コンテキストプロセッサーを使っている場合、テンプレートは RequestContext でレンダリングされる必要があります。もしくは、 messages をテンプレートコンテキストに対して有効にしてください。 メッセージが ... 2026年10月08日