... mport CSP SECURE_CSP = { "default-src" : [ CSP . SELF ], # Allow self-hosted scripts and script tags with matching `nonce` attr. "script-src" : [ CSP . SELF , CSP . NONCE ], # Example of the less secure 'unsafe-inline' option. "style-src" : [ CSP . S ... cript will be allowed. </ script > For external <script src="..."> and <link rel="stylesheet"> elements, use the csp_nonce_attr template tag: < script src = "/path/to/script.js" {% csp_nonce_attr %} ></ script > < link rel = "stylesheet" href = "/pat ... h/to/style.css" {% csp_nonce_attr %} > To render a Media object's assets with the nonce applied to each element, pass the object to the csp_nonce_attr tag: ... ... mport CSP SECURE_CSP = { "default-src" : [ CSP . SELF ], # Allow self-hosted scripts and script tags with matching `nonce` attr. "script-src" : [ CSP . SELF , CSP . NONCE ], # Example of the less secure 'unsafe-inline' option. "style-src" : [ CSP . S ... cript will be allowed. </ script > For external <script src="..."> and <link rel="stylesheet"> elements, use the csp_nonce_attr template tag: < script src = "/path/to/script.js" {% csp_nonce_attr %} ></ script > < link rel = "stylesheet" href = "/pat ... h/to/style.css" {% csp_nonce_attr %} > To render a Media object's assets with the nonce applied to each element, pass the object to the csp_nonce_attr tag: ... ... processor needs to be enabled. It adds a csp_nonce variable to the template context. Changed in Django 6.1: The csp_nonce_attr template tag was added, including support for rendering Media objects. For inline <script> and <style> elements, include t ... cript will be allowed. </ script > For external <script src="..."> and <link rel="stylesheet"> elements, use the csp_nonce_attr template tag: < script src = "/path/to/script.js" {% csp_nonce_attr %} ></ script > < link rel = "stylesheet" href = "/pat ... h/to/style.css" {% csp_nonce_attr %} > To render a Media object's assets with the nonce applied, pass the object to the csp_nonce_attr template tag: {% csp_ ... ... processor needs to be enabled. It adds a csp_nonce variable to the template context. Changed in Django 6.1: The csp_nonce_attr template tag was added, including support for rendering Media objects. For inline <script> and <style> elements, include t ... cript will be allowed. </ script > For external <script src="..."> and <link rel="stylesheet"> elements, use the csp_nonce_attr template tag: < script src = "/path/to/script.js" {% csp_nonce_attr %} ></ script > < link rel = "stylesheet" href = "/pat ... h/to/style.css" {% csp_nonce_attr %} > To render a Media object's assets with the nonce applied, pass the object to the csp_nonce_attr template tag: {% csp_ ... ... now only allows accessing the date/time formatting settings. バグ修正 ¶ Fixed a data loss possibility with Prefetch if to_attr is set to a ManyToManyField ( #25693 ). 目次 Django 1.7.11 リリースノート Fixed settings leak possibility in date template ... ... Prefetch ( "restaurants" , queryset = Restaurant . objects . select_related ( "best_pizza" )) ... ) また、オプションの to_attr で、事前読み込みの結果を独自の属性に割り当てることもできます。結果はリストに直接格納されます。 これにより、異なる QuerySet ... Pizza . objects . filter ( vegetarian = True ) >>> Restaurant . objects . prefetch_related ( ... Prefetch ( "pizzas" , to_attr = "menu" ), ... Prefetch ( "pizzas" , queryset = vegetarian_pizzas , to_attr = "vegetarian_menu" ), ... ) 独自の to_attr で ... etarian = True ) >>> Restaurant . objects . prefetch_related ( ... Prefetch ( "pizzas" , queryset = vegetarian_pizzas , to_attr = "vegetarian_menu" ), ... "vegetarian_menu__toppings" , ... ) to_attr の使用は、関係するマネージャのキャッシュにフィルタし ... ... now only allows accessing the date/time formatting settings. バグ修正 ¶ Fixed a data loss possibility with Prefetch if to_attr is set to a ManyToManyField ( #25693 ). 目次 Django 1.7.11 リリースノート Fixed settings leak possibility in date template ... ... Prefetch ( "restaurants" , queryset = Restaurant . objects . select_related ( "best_pizza" )) ... ) また、オプションの to_attr で、事前読み込みの結果を独自の属性に割り当てることもできます。結果はリストに直接格納されます。 これにより、異なる QuerySet ... Pizza . objects . filter ( vegetarian = True ) >>> Restaurant . objects . prefetch_related ( ... Prefetch ( "pizzas" , to_attr = "menu" ), ... Prefetch ( "pizzas" , queryset = vegetarian_pizzas , to_attr = "vegetarian_menu" ), ... ) 独自の to_attr で ... etarian = True ) >>> Restaurant . objects . prefetch_related ( ... Prefetch ( "pizzas" , queryset = vegetarian_pizzas , to_attr = "vegetarian_menu" ), ... "vegetarian_menu__toppings" , ... ) to_attr の使用は、関係するマネージャのキャッシュにフィルタし ... ... on with South migrations in the migrations directory to fail ( #25618 ). Fixed a data loss possibility with Prefetch if to_attr is set to a ManyToManyField ( #25693 ). Fixed a regression in 1.8 by making gettext() once again return UTF-8 bytestrings ... ... on with South migrations in the migrations directory to fail ( #25618 ). Fixed a data loss possibility with Prefetch if to_attr is set to a ManyToManyField ( #25693 ). Fixed a regression in 1.8 by making gettext() once again return UTF-8 bytestrings ... 2026年10月08日