{"id":1435,"date":"2026-08-07T22:32:09","date_gmt":"2026-08-07T13:32:09","guid":{"rendered":"https:\/\/gw-python.com\/?p=1435"},"modified":"2026-08-07T22:32:10","modified_gmt":"2026-08-07T13:32:10","slug":"django-4-2%e3%81%8b%e3%82%895-2%e3%81%b8%ef%bc%88%e5%be%8c%e7%b7%a8%ef%bc%89%e3%82%b3%e3%83%bc%e3%83%89%e3%81%ab%e5%ad%98%e5%9c%a8%e3%81%97%e3%81%aa%e3%81%84%e5%88%97%e5%90%8d%e3%82%a8%e3%83%a9","status":"publish","type":"post","link":"https:\/\/gw-python.com\/archives\/1435","title":{"rendered":"Django 4.2\u304b\u30895.2\u3078\uff08\u5f8c\u7de8\uff09\u30b3\u30fc\u30c9\u306b\u5b58\u5728\u3057\u306a\u3044\u5217\u540d\u30a8\u30e9\u30fc\u306e\u8ffd\u8de1"},"content":{"rendered":"<div class=\"veu_autoEyeCatchBox\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/d2xhvolyrst9d4.cloudfront.net\/wp-content\/uploads\/2026\/08\/17235704\/django4.2-5.2-1024x536.png\" class=\"attachment-large size-large wp-post-image\" alt=\"\" srcset=\"https:\/\/d2xhvolyrst9d4.cloudfront.net\/wp-content\/uploads\/2026\/08\/17235704\/django4.2-5.2-1024x536.png 1024w, https:\/\/d2xhvolyrst9d4.cloudfront.net\/wp-content\/uploads\/2026\/08\/17235704\/django4.2-5.2-300x157.png 300w, https:\/\/d2xhvolyrst9d4.cloudfront.net\/wp-content\/uploads\/2026\/08\/17235704\/django4.2-5.2-768x402.png 768w, https:\/\/d2xhvolyrst9d4.cloudfront.net\/wp-content\/uploads\/2026\/08\/17235704\/django4.2-5.2-1536x804.png 1536w, https:\/\/d2xhvolyrst9d4.cloudfront.net\/wp-content\/uploads\/2026\/08\/17235704\/django4.2-5.2.png 1556w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div>\n<p class=\"wp-block-paragraph\">\u7686\u3055\u307e\u3001\u3053\u3093\u306b\u3061\u306f\u3002\u30b0\u30ed\u30fc\u30d0\u30eb\u30a6\u30a7\u30a4\u306eK\u3067\u3059\u3002<br>\u524d\u7de8\u3067\u306f\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u524d\u306e\u6e96\u5099\u3068\u3057\u3066\u3001\u5909\u66f4\u524d\u306e\u74b0\u5883\u3092\u57fa\u6e96\u70b9\u3068\u3057\u3066\u78ba\u5b9a\u3057\u3001\u4f9d\u5b58\u95a2\u4fc2\u306e\u5909\u66f4\u7bc4\u56f2\u3092\u7d5e\u3063\u305f\u8a71\u3092\u304a\u4f1d\u3048\u3057\u307e\u3057\u305f\u3002\u5f8c\u7de8\u306f\u3001\u305d\u306e\u6e96\u5099\u304c\u5b9f\u969b\u306b\u52b9\u3044\u3066\u304f\u308b\u5834\u9762\u3067\u3059\u3002<br>\u6271\u3046\u306e\u306f\u3001\u3042\u308b\u691c\u7d22\u51e6\u7406\u3067\u767a\u751f\u3057\u305f500\u30a8\u30e9\u30fc\u3067\u3059\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u306f\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u5b58\u5728\u3057\u306a\u3044\u5217\u540d\u304c\u66d6\u6627\u3060\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u8fd4\u3063\u3066\u304d\u307e\u3057\u305f\u3002\u539f\u56e0\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30fc\u30c9\u3001Django ORM\u3001\u751f\u6210SQL\u3001PostgreSQL\u3068\u3044\u3046\u8907\u6570\u306e\u5c64\u306b\u307e\u305f\u304c\u3063\u3066\u3044\u307e\u3057\u305f\u3002\u4ee5\u4e0b\u3067\u306f\u3001\u305d\u306e\u5207\u308a\u5206\u3051\u306e\u904e\u7a0b\u3092\u9806\u306b\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u3053\u306e\u8a18\u4e8b\u306f\u4ee5\u4e0b\u306e\u65b9\u3092\u5bfe\u8c61\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u26055 Django\u958b\u767a\u7d4c\u9a13\u304c3\u5e74\u4ee5\u4e0a\u3002<br><span data-color=\"#fffd6b\" style=\"--vk-highlighter-color: rgba(255, 253, 107, 0.7);\" class=\"vk_highlighter\">\u26054 Django\u958b\u767a\u7d4c\u9a13\u304c1\u5e74\u4ee5\u4e0a<\/span><br>\u26053 WEB\u30b5\u30a4\u30c8\u958b\u767a\u7d4c\u9a13\u3042\u308a\u3002\u3053\u308c\u304b\u3089Django\u3092\u5b66\u7fd2\u3057\u307e\u3059\u3002<br>\u26052 Python \u521d\u7d1a\u8005\u3002\u7c21\u5358\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u30b3\u30fc\u30c9\u304c\u66f8\u3051\u307e\u3059\u3002<br>\u26051 \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u672a\u7d4c\u9a13\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b3\u30fc\u30c9\u306b\u5b58\u5728\u3057\u306a\u3044\u5217\u540d\u3067500\u30a8\u30e9\u30fc\u304c\u51fa\u305f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Django 5.2\u306b\u5909\u66f4\u3057\u305f\u5f8c\u3001\u904b\u7528\u62c5\u5f53\u8005\u5411\u3051\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u3042\u308b\u691c\u7d22\u51e6\u7406\u3067500\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u554f\u984c\u306f\u3001\u30af\u30a8\u30ea\u3092\u7d44\u307f\u7acb\u3066\u305f\u6642\u70b9\u3067\u306f\u306a\u304f\u3001\u8a55\u4fa1\u3057\u305f\u6642\u70b9\u3067\u8d77\u304d\u307e\u3057\u305f\u3002\u751f\u6210SQL\u3092\u8868\u793a\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u306f\u9032\u307f\u307e\u3059\u304c\u3001\u7d50\u679c\u3092\u53d6\u308a\u51fa\u3059\u305f\u3081\u306b\u30af\u30a8\u30ea\u3092\u8a55\u4fa1\u3057\u305f\u6bb5\u968e\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u30a8\u30e9\u30fc\u3092\u8fd4\u3057\u307e\u3059\u3002 <br>\u5185\u5bb9\u306f\u3001\u3042\u308b\u5217\u540d\u306e\u53c2\u7167\u304c\u66d6\u6627\u3067\u3042\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3057\u305f\u3002\u540c\u3058\u540d\u524d\u306e\u5217\u304c\u8907\u6570\u3042\u308a\u3001\u3069\u3061\u3089\u3092\u6307\u3059\u304b\u5224\u65ad\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u305d\u306e\u5217\u540d\u306f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u53d6\u5f97\u5217\u306e\u6307\u5b9a\u3092\u78ba\u8a8d\u3057\u3066\u3082\u898b\u5f53\u305f\u308a\u307e\u305b\u3093\u3002\u3053\u306e\u5217\u540d\u304c\u3069\u3053\u304b\u3089\u6765\u305f\u306e\u304b\u3092\u3001\u6b21\u306b\u8abf\u3079\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9577\u3044\u5225\u540d\u304cPostgreSQL\u306e63\u30d0\u30a4\u30c8\u5236\u9650\u3067\u5207\u308a\u8a70\u3081\u3089\u308c\u3066\u3044\u305f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u53d6\u5f97\u5217\u306e\u6307\u5b9a\u306b\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u3092\u591a\u6bb5\u306b\u305f\u3069\u308b\u975e\u5e38\u306b\u9577\u3044\u95a2\u9023\u53c2\u7167\u304c2\u3064\u542b\u307e\u308c\u3066\u3044\u307e\u3057\u305f\u3002\u5b9f\u969b\u306e\u540d\u79f0\u3092\u4e00\u822c\u5316\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u69cb\u9020\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\u3002\u672b\u5c3e\u306e name_code \u3068 person_type \u3060\u3051\u304c\u7570\u306a\u308a\u3001\u5148\u982d\u306e\u5171\u901a\u90e8\u5206\u304c\u975e\u5e38\u306b\u9577\u3044\u3001\u3068\u3044\u3046\u5f62\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px\"><code># values() \u306b\u6307\u5b9a\u3057\u3066\u3044\u305f\u30012\u3064\u306e\u9577\u3044\u95a2\u9023\u53c2\u7167\nqueryset.values(\n    \"hoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_by__name_code\",\n    \"hoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_by__person_type\",\n)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PostgreSQL\u306e\u8b58\u5225\u5b50\u306f\u3001\u6a19\u6e96\u8a2d\u5b9a\u3067\u306f\u6700\u592763\u30d0\u30a4\u30c8\u3067\u3059\u3002\u3053\u308c\u3092\u5927\u307e\u304b\u306b\u3044\u3046\u3068\u3001\u540d\u524d\u304c\u9577\u3059\u304e\u308b\u3068\u9014\u4e2d\u3067\u5f37\u5236\u7684\u306b\u5207\u308a\u8a70\u3081\u3089\u308c\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u3053\u306e2\u3064\u306f76\u6587\u5b57\u306878\u6587\u5b57\u3042\u308a\u3001\u672b\u5c3e\u306e\u7570\u306a\u308b\u90e8\u5206\u306b\u5230\u9054\u3059\u308b\u524d\u306b\u3001\u3069\u3061\u3089\u3082\u540c\u3058\u4f4d\u7f6e\u3067\u5207\u308a\u8a70\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px\"><code># \u672c\u6765\u306f\u672b\u5c3e\u304c\u7570\u306a\u308b\u3001\u5225\u3005\u306e2\u3064\u306e\u95a2\u9023\u53c2\u7167\n..._hoge_fuga_piyo_hogera__created_by__name_code\n..._hoge_fuga_piyo_hogera__created_by__person_type\n\n        \u2193 PostgreSQL \u304c 63 \u30d0\u30a4\u30c8\u3067\u5207\u308a\u8a70\u3081\u308b\n\n# \u3069\u3061\u3089\u3082\u540c\u3058\u5225\u540d\u306b\u306a\u308a\u3001\u533a\u5225\u3067\u304d\u306a\u304f\u306a\u308b\nhoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_\nhoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7d50\u679c\u3068\u3057\u3066\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u306f\u540c\u3058\u540d\u524d\u306e\u5217\u304c2\u3064\u4e26\u3093\u3067\u898b\u3048\u3001\u533a\u5225\u3067\u304d\u307e\u305b\u3093\u3002\u3053\u308c\u304c\u3001\u66d6\u6627\u3060\u3068\u3044\u3046\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3067\u3057\u305f\u3002\u8868\u793a\u3055\u308c\u305f\u30b3\u30fc\u30c9\u306b\u306a\u3044\u5217\u540d\u306f\u3001Django\u304c\u751f\u6210\u3057\u305f\u9577\u3044\u5225\u540d\u3092\u3001PostgreSQL\u304c\u5207\u308a\u8a70\u3081\u305f\u5f8c\u306e\u59ff\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">63\u30d0\u30a4\u30c8\u5236\u9650\u3060\u3051\u3067\u306f4.2\u3068\u306e\u5dee\u3092\u8aac\u660e\u3067\u304d\u306a\u304b\u3063\u305f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5207\u308a\u8a70\u3081\u304c\u8d77\u304d\u308b\u3053\u3068\u81ea\u4f53\u306f\u3001\u3053\u308c\u3067\u5206\u304b\u308a\u307e\u3057\u305f\u3002\u305f\u3060\u3057\u3001\u3053\u306e\u8aac\u660e\u306b\u306f\u6b8b\u308b\u70b9\u304c\u3042\u308a\u307e\u3057\u305f\u300263\u30d0\u30a4\u30c8\u5236\u9650\u306fDjango\u306e\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9\u3067\u52a0\u308f\u3063\u305f\u3082\u306e\u3067\u306f\u306a\u304f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3082\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30fc\u30c9\u3082\u540c\u3058\u3067\u3059\u3002\u305d\u308c\u306b\u3082\u304b\u304b\u308f\u3089\u305a\u3001Django 4.2.26\u3067\u306f\u6b63\u5e38\u30015.2\u3067\u306f\u30a8\u30e9\u30fc\u3001\u3068\u3044\u3046\u5dee\u304c\u3042\u308a\u307e\u3057\u305f\u3002\u5236\u9650\u3060\u3051\u304c\u539f\u56e0\u306a\u3089\u30014.2\u3067\u3082\u540c\u3058\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u308b\u306f\u305a\u3067\u3059\u3002 \u3053\u306e\u5dee\u306f\u3001Django\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u751f\u6210SQL\u304c\u7570\u306a\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3057\u305f\u3002\u306a\u304a\u3001\u3053\u306e\u6319\u52d5\u5909\u5316\u306f\u30ea\u30ea\u30fc\u30b9\u30ce\u30fc\u30c8\u306b\u660e\u8a18\u3055\u308c\u3066\u304a\u3089\u305a\u3001\u8abf\u67fb\u3057\u305f\u7bc4\u56f2\u3067\u306f\u3001\u540c\u3058\u73fe\u8c61\u306e\u4e8b\u4f8b\u3092Web\u4e0a\u3067\u898b\u3064\u3051\u3089\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u305d\u306e\u305f\u3081\u3001\u540c\u540d\u306e\u5217\u306e\u885d\u7a81\u3092\u7591\u3063\u3066\u30b3\u30fc\u30c9\u3092\u78ba\u8a8d\u3057\u3001\u8a72\u5f53\u304c\u306a\u3044\u3053\u3068\u304b\u3089\u8b58\u5225\u5b50\u306e\u5207\u308a\u8a70\u3081\u3092\u7591\u3063\u3066\u9577\u3055\u3092\u6570\u3048\u308b\u3001\u3068\u3044\u3046\u624b\u9806\u3067\u3001\u4eee\u8aac\u3068\u691c\u8a3c\u3092\u624b\u5143\u3067\u5f80\u5fa9\u3055\u305b\u306a\u304c\u3089\u9032\u3081\u307e\u3057\u305f\u300263\u30d0\u30a4\u30c8\u5236\u9650\u306b\u305f\u3069\u308a\u7740\u3044\u305f\u5f8c\u30824.2\u3068\u306e\u5dee\u304c\u6b8b\u3063\u305f\u305f\u3081\u3001\u6b21\u306f\u751f\u6210SQL\u306e\u6bd4\u8f03\u306b\u9032\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Django\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3060\u3051\u3092\u5909\u3048\u3066\u6bd4\u8f03\u3057\u305f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u56e0\u3092\u5207\u308a\u5206\u3051\u308b\u305f\u3081\u3001\u6761\u4ef6\u3092\u305d\u308d\u3048\u3066\u6bd4\u8f03\u3057\u307e\u3057\u305f\u3002\u524d\u7de8\u3067\u78ba\u5b9a\u3057\u305f\u57fa\u6e96\u70b9\u3092\u4f7f\u3044\u3001\u540c\u3058\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3001\u540c\u3058\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3001\u540c\u3058Python\u3001\u540c\u3058\u691c\u7d22\u6761\u4ef6\u306e\u307e\u307e\u3001Django\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3060\u3051\u3092\u5909\u3048\u307e\u3059\u3002\u6bd4\u8f03\u3057\u305f\u306e\u306f\u3001Django 4.2.26\u30015.2\u30015.2.11\u306e3\u3064\u3067\u3059\u3002\u753b\u9762\u64cd\u4f5c\u3067\u306f\u4f59\u8a08\u306a\u6761\u4ef6\u304c\u6df7\u3056\u308b\u305f\u3081\u3001\u5bfe\u8c61\u306e\u51e6\u7406\u3092\u30b7\u30a7\u30eb\u304b\u3089\u76f4\u63a5\u547c\u3073\u51fa\u3057\u3066\u518d\u73fe\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px\"><code># \u4ed6\u3092\u3059\u3079\u3066\u56fa\u5b9a\u3057\u3001Django \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3060\u3051\u3092\u5909\u3048\u3066\u6bd4\u8f03\n\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9    \u56fa\u5b9a\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9    \u56fa\u5b9a\nPython          \u56fa\u5b9a\n\u691c\u7d22\u6761\u4ef6        \u56fa\u5b9a\nDjango          4.2.26  \u2192  5.2  \u2192  5.2.11   # \u3053\u308c\u3060\u3051\u5909\u3048\u308b<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u751f\u6210SQL\u3092\u6bd4\u8f03\u3059\u308b\u3068\u3001values() \u3084 values_list() \u3067\u53d6\u5f97\u3059\u308b\u5217\u306e\u5225\u540d\u306e\u6271\u3044\u306b\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u9593\u3067\u9055\u3044\u304c\u3042\u308a\u307e\u3057\u305f\u3002Django 5.2\u3067\u306f\u3001\u6307\u5b9a\u3057\u305f\u540d\u524d\u3092\u4fdd\u6301\u3059\u308b\u5f62\u3067\u5225\u540d\u304c\u660e\u793a\u7684\u306b\u4ed8\u304f\u30b1\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u3059\u3079\u3066\u306eSQL\u5dee\u5206\u304c\u4eca\u56de\u306e\u30a8\u30e9\u30fc\u306b\u76f4\u7d50\u3057\u305f\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u5dee\u306e\u6709\u7121\u3068\u3001\u305d\u308c\u304c\u4eca\u56de\u306e\u539f\u56e0\u304b\u3069\u3046\u304b\u306f\u5206\u3051\u3066\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u539f\u56e0\u306fORM\u306e\u5225\u540d\u5909\u5316\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5236\u9650\u306e\u7d44\u307f\u5408\u308f\u305b\u3060\u3063\u305f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u56e0\u3092\u3088\u308a\u6b63\u78ba\u306b\u7406\u89e3\u3059\u308b\u305f\u3081\u3001Django\u672c\u4f53\u306e\u5b9f\u88c5\u3082\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">values()<\/mark> \u3067\u6307\u5b9a\u3057\u305f\u540d\u524d\u304c\u3001\u3069\u3046SELECT\u5217\u3068\u5225\u540d\u306b\u5909\u63db\u3055\u308c\u308b\u306e\u304b\u3002<mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">Query.selected<\/mark> \u3084 <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">SQLCompiler.get_select()<\/mark> \u3092\u8ffd\u3044\u3001\u53d6\u5f97\u5217\u306e\u5225\u540d\u304c\u3069\u3053\u3067\u751f\u6210\u3055\u308c\u308b\u304b\u306b\u7684\u3092\u7d5e\u3063\u3066\u8aad\u307f\u9032\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px\"><code># 3\u3064\u304c\u91cd\u306a\u3063\u305f\u3068\u304d\u3060\u3051\u3001\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u308b\n\u9577\u3044\u95a2\u9023\u53c2\u7167           \u2510\nDjango 5.2 \u306e\u5225\u540d\u5909\u5316  \u253c\u2192 63\u30d0\u30a4\u30c8\u3067\u5225\u540d\u304c\u885d\u7a81 \u2192 ambiguous \u30a8\u30e9\u30fc\nPostgreSQL 63\u30d0\u30a4\u30c8\u5236\u9650 \u2518<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u7d42\u7684\u306b\u306f\u3001\u539f\u56e0\u306f\u3001\u8907\u6570\u306e\u5c64\u304c\u4ea4\u5dee\u3057\u305f\u69cb\u9020\u306b\u3042\u308b\u3068\u5206\u304b\u308a\u307e\u3057\u305f\u3002\u9577\u3044\u95a2\u9023\u53c2\u7167\u3001Django 5.2\u3067\u306e\u5225\u540d\u306e\u6271\u3044\u306e\u5909\u5316\u3001PostgreSQL\u306e63\u30d0\u30a4\u30c8\u5236\u9650\u3002\u4eca\u56de\u306e\u74b0\u5883\u3067\u306f\u3001\u3053\u306e3\u3064\u304c\u91cd\u306a\u3063\u305f\u3068\u304d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<strong>\u300cDjango 5.2\u304c\u60aa\u3044\u300d\u3068\u3082\u300cPostgreSQL\u304c\u60aa\u3044\u300d\u3068\u3082\u8a00\u3044\u5207\u308c\u307e\u305b\u3093\u3002<\/strong>Django 5.2\u3067\u5225\u540d\u306e\u6271\u3044\u304c\u5909\u308f\u308a\u3001\u4ee5\u524d\u306f\u8868\u9762\u5316\u3057\u3066\u3044\u306a\u304b\u3063\u305fPostgreSQL\u306e\u5236\u9650\u3068\u306e\u885d\u7a81\u304c\u3001\u521d\u3081\u3066\u8868\u306b\u51fa\u305f\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u77ed\u3044\u5225\u540d\u3092\u660e\u793a\u3057\u3066\u885d\u7a81\u3092\u56de\u907f\u3059\u308b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fee\u6b63\u65b9\u91dd\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002\u9577\u3044\u95a2\u9023\u53c2\u7167\u305d\u306e\u3082\u306e\u306f\u5909\u3048\u305a\u3001F() \u3092\u4f7f\u3063\u3066\u77ed\u304f\u610f\u5473\u306e\u5206\u304b\u308b\u5225\u540d\u3092\u660e\u793a\u3057\u307e\u3059\u3002\u95a2\u9023\u3084\u30e2\u30c7\u30eb\u3001\u53d6\u5f97\u3059\u308b\u5185\u5bb9\u306f\u5909\u3048\u306a\u3044\u305f\u3081\u3001\u5f71\u97ff\u7bc4\u56f2\u3092\u6700\u5c0f\u9650\u306b\u6291\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px\"><code># \u4fee\u6b63\u524d\uff1a\u9577\u3044\u95a2\u9023\u53c2\u7167\u3092\u305d\u306e\u307e\u307e values() \u306b\u6e21\u3057\u3066\u3044\u305f\n# \u2192 \u9577\u3044\u540d\u524d\u304c\u5225\u540d\u306b\u306a\u308a\u300163\u30d0\u30a4\u30c8\u3067\u5207\u308a\u8a70\u3081\u3089\u308c\u3066\u885d\u7a81\u3059\u308b\nqueryset.values(\n    \"hoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_by__name_code\",\n    \"hoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_by__person_type\",\n)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px\"><code># \u4fee\u6b63\u5f8c\uff1aF() \u3067\u77ed\u3044\u5225\u540d\u3092\u660e\u793a\u3059\u308b\nfrom django.db.models import F\n\nqueryset.values(\n    created_by_name=F(   # \u2190 \u77ed\u3044\u5225\u540d\u3092\u4ed8\u3051\u308b\n        \"hoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_by__name_code\"\n    ),\n    created_by_type=F(\n        \"hoge_fuga_piyo_hogera_hogehoge__hoge_fuga_piyo_hogera__created_by__person_type\"\n    ),\n)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\" style=\"border-width:1px\"><code>-- \u751f\u6210SQL\uff1a\u77ed\u3044\u5225\u540d\u306b\u306a\u308a\u3001\u5207\u308a\u8a70\u3081\u304c\u8d77\u304d\u306a\u3044\nSELECT\n    ... AS \"created_by_name\",\n    ... AS \"created_by_type\"\nFROM ...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4fee\u6b63\u524d\u306f\u3001\u9577\u3044\u95a2\u9023\u53c2\u7167\u3092 <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">values()<\/mark> \u306b\u305d\u306e\u307e\u307e\u6e21\u3057\u3066\u3044\u307e\u3057\u305f\u3002\u3053\u306e\u5834\u5408\u3001\u305d\u306e\u9577\u3044\u540d\u524d\u304cSELECT\u5217\u306e\u5225\u540d\u3068\u3057\u3066\u4f7f\u308f\u308c\u300163\u30d0\u30a4\u30c8\u3067\u5207\u308a\u8a70\u3081\u3089\u308c\u307e\u3059\u3002\u4fee\u6b63\u5f8c\u306f\u3001<mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">created_by_name<\/mark> \u3068 <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">created_by_type<\/mark> \u3068\u3044\u3046\u77ed\u3044\u5225\u540d\u3092 <mark style=\"background-color:#e3e3e3\" class=\"has-inline-color\">F()<\/mark> \u3067\u4e0e\u3048\u307e\u3059\u3002\u751f\u6210SQL\u3067\u3082\u77ed\u3044\u5225\u540d\u304c\u4f7f\u308f\u308c\u3001\u5207\u308a\u8a70\u3081\u306b\u3088\u308b\u885d\u7a81\u306f\u8d77\u3053\u308a\u307e\u305b\u3093\u3002\u30e2\u30c7\u30eb\u9593\u306e\u95a2\u9023\u3084\u53d6\u5f97\u5185\u5bb9\u3092\u5909\u3048\u305a\u306b\u3001\u8b58\u5225\u5b50\u9577\u5236\u9650\u3092\u56de\u907f\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f8c\u7de8\u3067\u304a\u4f1d\u3048\u3057\u305f\u304b\u3063\u305f\u306e\u306f\u3001\u6b21\u306e\u70b9\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"has-background wp-block-paragraph\" style=\"background-color:#e4f6e8\"><strong>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b3\u30fc\u30c9\u304c\u540c\u3058\u3067\u3082\u3001Django\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u5909\u308f\u308c\u3070\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5c4a\u304fSQL\u307e\u3067\u540c\u3058\u3068\u306f\u9650\u308a\u307e\u305b\u3093\u3002<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">63\u30d0\u30a4\u30c8\u5236\u9650\u3092\u898b\u3064\u3051\u305f\u6642\u70b9\u3067\u8abf\u67fb\u3092\u7d42\u3048\u3066\u3044\u305f\u3089\u30014.2\u3067\u52d5\u3044\u3066\u3044\u305f\u7406\u7531\u3092\u8aac\u660e\u3067\u304d\u306a\u3044\u307e\u307e\u3067\u3057\u305f\u3002\u8aac\u660e\u3067\u304d\u306a\u3044\u5dee\u304c\u6b8b\u308b\u9650\u308a\u3001\u6b21\u306e\u4eee\u8aac\u3078\u9032\u3093\u3060\u3053\u3068\u3067\u3001\u8907\u6570\u306e\u5c64\u304c\u4ea4\u5dee\u3057\u3066\u751f\u3058\u305f\u539f\u56e0\u306b\u305f\u3069\u308a\u7740\u3051\u307e\u3057\u305f\u3002\u539f\u56e0\u304c\u5206\u304b\u3089\u306a\u3044\u3068\u304d\u307b\u3069\u3001\u751f\u6210SQL\u3092\u78ba\u8a8d\u3059\u308b\u4fa1\u5024\u304c\u3042\u308a\u307e\u3059\u3002\u540c\u69d8\u306e\u969c\u5bb3\u306b\u5411\u304d\u5408\u3046\u65b9\u306e\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u203b\u672c\u8a18\u4e8b\u306e\u30b5\u30e0\u30cd\u30a4\u30eb\u753b\u50cf\u306f\u3001\u751f\u6210AI\u3092\u4f7f\u7528\u3057\u3066\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7686\u3055\u307e\u3001\u3053\u3093\u306b\u3061\u306f\u3002\u30b0\u30ed\u30fc\u30d0\u30eb\u30a6\u30a7\u30a4\u306eK\u3067\u3059\u3002\u524d\u7de8\u3067\u306f\u3001\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u524d\u306e\u6e96\u5099\u3068\u3057\u3066\u3001\u5909\u66f4\u524d\u306e\u74b0\u5883\u3092\u57fa\u6e96\u70b9\u3068\u3057\u3066\u78ba\u5b9a\u3057\u3001\u4f9d\u5b58\u95a2\u4fc2\u306e\u5909\u66f4\u7bc4\u56f2\u3092\u7d5e\u3063\u305f\u8a71\u3092\u304a\u4f1d\u3048\u3057\u307e\u3057\u305f\u3002\u5f8c\u7de8\u306f\u3001\u305d\u306e\u6e96\u5099\u304c\u5b9f\u969b\u306b\u52b9\u3044\u3066\u304f\u308b\u5834\u9762\u3067\u3059\u3002\u6271\u3046\u306e\u306f [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":1433,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"vkexunit_cta_each_option":"","footnotes":""},"categories":[37,39],"tags":[],"employee-number":[],"class_list":["post-1435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django","category-orm-django"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/posts\/1435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/comments?post=1435"}],"version-history":[{"count":1,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/posts\/1435\/revisions"}],"predecessor-version":[{"id":1436,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/posts\/1435\/revisions\/1436"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/media\/1433"}],"wp:attachment":[{"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/media?parent=1435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/categories?post=1435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/tags?post=1435"},{"taxonomy":"employee-number","embeddable":true,"href":"https:\/\/gw-python.com\/wp-json\/wp\/v2\/employee-number?post=1435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}