{"id":2575,"date":"2021-02-11T09:02:50","date_gmt":"2021-02-11T00:02:50","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=2575"},"modified":"2021-02-12T12:45:43","modified_gmt":"2021-02-12T03:45:43","slug":"post-2575","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/11\/post-2575\/","title":{"rendered":"Django\uff1a\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306e\u30da\u30fc\u30b8\u756a\u53f7\u3092\u826f\u3044\u611f\u3058\u3067\u7e2e\u3081\u308b\u65b9\u6cd5"},"content":{"rendered":"<h2>Django\uff1a\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306e\u30da\u30fc\u30b8\u756a\u53f7\u3092\u826f\u3044\u611f\u3058\u3067\u7e2e\u3081\u308b\u65b9\u6cd5<\/h2>\n<p><a href=\"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/09\/post-2572\/\">\u5148\u56de\u306e\u8a18\u4e8b<\/a>\u3067\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306e\u5927\u67a0\u306b\u3064\u3044\u3066\u306f\u8a18\u8f09\u3057\u307e\u3057\u305f\u3002<br \/>\n\u4eca\u56de\u306f\u3053\u306e\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u826f\u3044\u611f\u3058\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3067\u3059\u3002<\/p>\n<h3>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306f1\u56de\u4f5c\u3063\u3066\u3057\u307e\u3048\u3070 include\u3067\u547c\u3073\u51fa\u3057\u3066\u4f7f\u3044\u307e\u308f\u305b\u308b<\/h3>\n<p>\u3061\u3083\u3093\u3068\u4f5c\u3063\u3066\u3057\u307e\u3063\u305f\u65b9\u304c\uff08\u7cbe\u795e\u885b\u751f\u4e0a\uff09\u697d\u306a\u7406\u7531\u304c\u30b3\u30ec\u3067\u3059\u3002<br \/>\n\u30b5\u30a4\u30c8\u5185\u3067\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30b6\u30a4\u30f3\u3092\u5927\u304d\u304f\u5909\u3048\u308b\u3053\u3068\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\nDjango\u3067\u306fHTML\u306eInclude\u304c\u7c21\u5358\u306b\u3067\u304d\u308b\u306e\u3067\u300c\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u4f5c\u3063\u3061\u3083\u3048\u3070\u3044\u3044\u3058\u3083\u3093\u300d\u3068\u306a\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u6642\u306e\u6ce8\u610f\u4e8b\u9805\u304c2\u70b9\u3042\u308a\u307e\u3059\u3002<\/p>\n<div class=\"paperBox\">\n<ol>\n<li>Template\u306b\u6e21\u3059List\u306e\u30c7\u30fc\u30bf\u540d\uff08\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d\uff09\u3092\u5171\u901a\u306b\u3057\u3066\u304a\u304f<\/li>\n<li>\u691c\u7d22\u7528\u306e\u5f15\u6570\u306fGET\u3067\u6e21\u3059<\/li>\n<\/ol>\n<\/div>\n<p>\u5171\u901a\u306e\u540d\u524d\u3067\u306a\u3044\u3068\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d\u306e\u5909\u66f4\u304c\u5fc5\u8981\u306b\u306a\u308b\u304b\u3089\u3067\u3059\u3002<br \/>\n\u30d7\u30ea\u30bb\u30c3\u30c8Class\u306eListView\u3092\u4f7f\u3046\u5834\u5408\u3010object_list\u3011\u3068\u3044\u3046\u540d\u79f0\u3067Template\u306b\u9001\u3089\u308c\u308b\u306e\u3067\u3001\u3053\u306e\u540d\u79f0\u3092\u305d\u306e\u307e\u307e\u4f7f\u3046\u306e\u304c\u6700\u3082\u6c4e\u7528\u6027\u304c\u9ad8\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>GET\u304bPOST\u304b\u3068\u3044\u3046\u70b9\u306b\u3064\u3044\u3066\u306f\u3001\u691c\u7d22\u7528\u5f15\u6570\u3092POST\u3067\u6e21\u3057\u3066\u3082OK\u3067\u3059\u3002<br \/>\n\u304c\u3001\u30da\u30fc\u30b8\u9077\u79fb\u306e\u969b\u306b\u6bce\u56dePOST\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067GET\u306e\u65b9\u304c\u7c21\u5358\u3067\u3059\u3002<br \/>\n\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u7684\u306bNG\u306e\u5834\u5408\u3092\u9664\u3044\u3066\u30c7\u30fc\u30bf\u691c\u7d22\u306e\u9805\u76ee\u306fGET\u3067\u6e21\u3057\u305f\u65b9\u304c\u826f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u524d\u56de\u8a18\u4e8b\u3067\u3082\u66f8\u304d\u307e\u3057\u305f\u304c\u3001GET\u3067\u6e21\u3057\u305f\u5024\u3092Template\u306b\u623b\u3059\u65b9\u6cd5\u306f\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\n\u25a0Veiws<\/p>\n<pre class=\"lang:default decode:true\">from urllib.parse import urlencode\r\n\r\n  def HogeListView(request,num=1):\r\n  (\u4e2d\u7565)\r\n    #get\u306e\u5024\u306frequest.GET\u3067\u53d6\u308a\u8fbc\u307e\u308c\u308b\r\n    #\u3053\u308c\u3092URL\u30a8\u30f3\u30b3\u30fc\u30c9\u3059\u308b\u3068GET\u306e\u59ff\u305d\u306e\u307e\u307eTemplate\u306b\u6e21\u305b\u308b\r\n    get_request = urlencode(request.GET)\r\n    params = {\r\n        'object_list': object_list.get_page(num),\r\n        'get_request': get_request\r\n    }\r\n  (\u5f8c\u7565)<\/pre>\n<h3>\u4f55\u3082\u8003\u3048\u305a\u306bpage_range\u3092for\u30eb\u30fc\u30d7\u3057\u3066\u8868\u793a\u3059\u308b\u3068\u4ef6\u6570\u306b\u3088\u3063\u3066\u304a\u304b\u3057\u306a\u72b6\u614b\u306b...<\/h3>\n<p><a> <img loading=\"lazy\" decoding=\"async\" width=\"1032\" height=\"212\" data-attachment-id=\"2588\" data-permalink=\"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/11\/post-2575\/pagenation_01\/\" data-orig-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_01.png\" data-orig-size=\"1032,212\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"pagenation_01\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_01-1024x210.png\" class=\"alignnone size-medium wp-image-2588\" src=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_01.png\" alt=\"\" srcset=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_01.png 1032w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_01-300x62.png 300w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_01-1024x210.png 1024w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_01-768x158.png 768w\" sizes=\"auto, (max-width: 1032px) 100vw, 1032px\" \/><\/a><br \/>\n\u3055\u3059\u304c\u306b\u30b3\u30ec\u306f\u306a\u3044\u3067\u3059\u3088\u306d\u3002<br \/>\n\u3068\u8a00\u3046\u4e8b\u3067\u30eb\u30fc\u30eb\u4f5c\u308a\u304b\u3089\u66f8\u3044\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3>\u7701\u7565\u3055\u308c\u305f\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u30eb\u30fc\u30eb\u4f5c\u308a<\/h3>\n<p>\u4f5c\u696d\u306e\u6bb5\u53d6\u308a\u306f\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<div class=\"borderBox\">\n<ol>\n<li>\u53d6\u5f97\u3067\u304d\u308b\u5024\u3092\u6574\u7406\u3059\u308b<\/li>\n<li>\u53d6\u5f97\u3067\u304d\u308b\u5024\u3092\u4f7f\u3063\u3066\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u306b\u3042\u3063\u305f\u753b\u9762\u69cb\u6210\u3092\u8003\u3048\u308b<\/li>\n<li>\u6a19\u6e96\u3068\u4f8b\u5916\u3092\u8003\u3048\u30eb\u30fc\u30eb\u306e\u6982\u8981\u3092\u6574\u3048\u308b<\/li>\n<li>\u7c21\u5358\u306b\u5b9f\u88c5\u3059\u308b\uff08\u5834\u5408\u5206\u3051\u30d1\u30fc\u30c4\u306e\u307f\u3067\u69cb\u6210\u3057\u3066\u307f\u308b\uff09<\/li>\n<li>\u554f\u984c\u306a\u3051\u308c\u3070\u3057\u3063\u304b\u308a\u3068\u3057\u305f\u5b9f\u88c5\u3092\u884c\u3046<\/li>\n<li>\u7d30\u304b\u306a\u4fee\u6b63\u3092\u884c\u3046<\/li>\n<li>\u5b8c\u4e86<\/li>\n<\/ol>\n<\/div>\n<h4>Template\u3067\u53d6\u5f97\u3067\u304d\u308b\u5024\u3092\u6574\u7406\u3059\u308b<\/h4>\n<div class=\"paperBox\">\n<ul>\n<li>\u30ea\u30b9\u30c8\uff08\u30c6\u30fc\u30d6\u30eb\u306e\u5024\uff1aDB\uff09 =&gt;\u00a0 object_list\u3067\u6e21\u3057\u305f\u6642<\/li>\n<li>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u524d\u9801\u756a\u53f7 =&gt;\u00a0 object_list.previous_page_number<\/li>\n<li>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u6b21\u9801\u756a\u53f7 =&gt;\u00a0 object_list.next_page_number<\/li>\n<li>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u9801\u30ea\u30b9\u30c8 =&gt;\u00a0 object_list.paginator.page_range<\/li>\n<li>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u524d\u9801\u3042\u308b\u304b =&gt;\u00a0 object_list.has_previous<\/li>\n<li>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u6b21\u9801\u3042\u308b\u304b =&gt;\u00a0 object_list.has_next<\/li>\n<li>\u73fe\u5728\u306e\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u756a\u53f7 =&gt;\u00a0 object_list.numbers<\/li>\n<li>\u6700\u7d42\u306e\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u756a\u53f7 =&gt;\u00a0 object_list.paginator.num_pages<\/li>\n<\/ul>\n<\/div>\n<h4>\u53d6\u5f97\u3067\u304d\u308b\u5024\u3092\u4f7f\u3063\u3066\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u306b\u3042\u3063\u305f\u753b\u9762\u69cb\u6210\u3092\u8003\u3048\u308b<\/h4>\n<p>\u3053\u3093\u306a\u69cb\u9020\u3067\u8003\u3048\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1031\" height=\"100\" data-attachment-id=\"2589\" data-permalink=\"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/11\/post-2575\/pagenation_02\/\" data-orig-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02.png\" data-orig-size=\"1031,100\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"pagenation_02\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02-1024x99.png\" class=\"alignnone size-medium wp-image-2589\" src=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02.png\" alt=\"\" srcset=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02.png 1031w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02-300x29.png 300w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02-1024x99.png 1024w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagenation_02-768x74.png 768w\" sizes=\"auto, (max-width: 1031px) 100vw, 1031px\" \/><\/a><br \/>\n\u4e00\u756a\u5de6\u5074\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068page\uff1d1\u3001\u4e00\u756a\u53f3\u5074\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068page=last\u306b\u98db\u3076\u3088\u3046\u306b\u4ed5\u639b\u3051\u307e\u3059\u3002<br \/>\n\u3067\u3001\u771f\u3093\u4e2d\u306f38\u500b\u4e26\u3079\u305f\u308a\u305b\u305a\u524d\u5f8c\u3092\u7701\u7565\u3002\u73fe\u5728\u306e\u30da\u30fc\u30b8\u756a\u53f7\u3092\u631f\u3093\u3067\u6bce\u56de\u524d\u5f8c2\u9801\u3092\u9078\u3079\u308b\u59ff\u306b\u3057\u307e\u3059\u3002<\/p>\n<h4>\u6a19\u6e96\u3068\u4f8b\u5916\u3092\u8003\u3048\u30eb\u30fc\u30eb\u306e\u6982\u8981\u3092\u6574\u3048\u308b<\/h4>\n<p>\u73fe\u5728\u306e\u30da\u30fc\u30b8\u756a\u53f7\u306f\u3010object_list.numbers\u3011\u3067\u53d6\u308a\u51fa\u305b\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3092\u4e2d\u5fc3\u306b\u3057\u3066\u524d\u5f8c2\u30da\u30fc\u30b8\u3092\u4e26\u3079\u3088\u3046\u3068\u3057\u305f\u5834\u5408\u30015\u3064\u306e\u4e26\u3073\u306f\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u25a0Normal\u30eb\u30fc\u30c8<\/p>\n<div class=\"paperBox\">\n<ul>\n<li>\u5de6\u304b\u30891\u3064\u76ee\uff5cobject_list.numbers - 2<\/li>\n<li>\u5de6\u304b\u30892\u3064\u76ee\uff5cobject_list.numbers - 1<\/li>\n<li>\u771f\u3093\u4e2d\u3000\uff5cobject_list.numbers<\/li>\n<li>\u5de6\u304b\u30894\u3064\u76ee\uff5cobject_list.numbers + 1<\/li>\n<li>\u5de6\u304b\u30895\u3064\u76ee\uff5cobject_list.numbers + 2<\/li>\n<\/ul>\n<\/div>\n<p>\u6b21\u306b\u4f8b\u5916\u3092\u8003\u3048\u3066\u307f\u307e\u3059\u3002object_list.numbers = 2\u306e\u6642\u306f\u3069\u3046\u8868\u793a\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u65b9\u5411\u6027\u3068\u3057\u3066\u306f2\u3064\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<div class=\"borderBox\">\u25bc\u5897\u6e1b\u51fa\u6765\u306a\u3044\u5834\u5408\u306f\u8868\u793a\u3057\u306a\u3044 \u203b\u30dc\u30bf\u30f3\u7dcf\u6570\u304c\u5909\u308f\u308b<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1029\" height=\"82\" data-attachment-id=\"2599\" data-permalink=\"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/11\/post-2575\/pagination_03\/\" data-orig-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03.png\" data-orig-size=\"1029,82\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"pagination_03\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-1024x82.png\" class=\"alignnone size-medium wp-image-2599\" src=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03.png\" alt=\"\" srcset=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03.png 1029w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-300x24.png 300w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-1024x82.png 1024w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-768x61.png 768w\" sizes=\"auto, (max-width: 1029px) 100vw, 1029px\" \/><br \/>\n\u25bcNormal\u30eb\u30fc\u30c8\u306e\u30eb\u30fc\u30eb\u3092\u5909\u66f4\u3059\u308b \u203b\u30dc\u30bf\u30f3\u7dcf\u6570\u3092\u7dad\u6301\u3059\u308b<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1029\" height=\"80\" data-attachment-id=\"2600\" data-permalink=\"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/11\/post-2575\/pagination_04\/\" data-orig-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_04.png\" data-orig-size=\"1029,80\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"pagination_04\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_04-1024x80.png\" class=\"alignnone size-medium wp-image-2600\" src=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_04.png\" alt=\"\" srcset=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_04.png 1029w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_04-300x23.png 300w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_04-1024x80.png 1024w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_04-768x60.png 768w\" sizes=\"auto, (max-width: 1029px) 100vw, 1029px\" \/><\/div>\n<p>6\u30da\u30fc\u30b8\u76ee\u307e\u3067\u5b58\u5728\u3059\u308b\u306e\u306b4\u3067\u7d42\u308f\u308b\u3068\u3044\u3046\u306e\u306f\u30c1\u30e7\u30c3\u30c8\u4e0d\u6e80\u3067\u3059\u3002\u306a\u306e\u3067\u30015\u3068\u3044\u3046\u67a0\u3092\u7dad\u6301\u3059\u308b\u65b9\u5411\u3067\u8003\u3048\u307e\u3059\u3002<\/p>\n<p>\u25a0Under\u30eb\u30fc\u30c8<br \/>\nobject_list.numbers = 2\u306e\u6642\u306e\u30dc\u30bf\u30f3\u306e\u4e26\u3073\u306f\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"paperBox\">\n<ul>\n<li>\u5de6\u304b\u30891\u3064\u76ee\uff5cobject_list.numbers - 1<\/li>\n<li>\u5de6\u304b\u30892\u3064\u76ee\uff5cobject_list.numbers<\/li>\n<li>\u771f\u3093\u4e2d\u3000\uff5cobject_list.numbers + 1<\/li>\n<li>\u5de6\u304b\u30894\u3064\u76ee\uff5cobject_list.numbers + 2<\/li>\n<li>\u5de6\u304b\u30895\u3064\u76ee\uff5cobject_list.numbers + 3<\/li>\n<\/ul>\n<\/div>\n<p>\u25a0High\u30eb\u30fc\u30c8<br \/>\n\u3053\u308c\u306f\u6700\u7d42\u9801\u306e1\u3064\u524d\u306e\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u8868\u793a\u3057\u3066\u3044\u308b\u3068\u304d\u3082\u540c\u3058\u3067\u3059\u3002<\/p>\n<div class=\"paperBox\">\n<ul>\n<li>\u5de6\u304b\u30891\u3064\u76ee\uff5cobject_list.number - 3<\/li>\n<li>\u5de6\u304b\u30892\u3064\u76ee\uff5cobject_list.number -2<\/li>\n<li>\u771f\u3093\u4e2d\u3000\uff5cobject_list.number -1<\/li>\n<li>\u5de6\u304b\u30894\u3064\u76ee\uff5cobject_list.number<\/li>\n<li>\u5de6\u304b\u30895\u3064\u76ee\uff5cobject_list.number +1<\/li>\n<\/ul>\n<\/div>\n<p>Under\/High\u3068\u3082\u306b\u73fe\u5728\u5024\u304b\u3089\u306e\u5dee\u7570 = 2\u3067\u4e2d\u592e\u306b\u6765\u308b\u306e\u3067\u30b3\u30b3\u306b\u5206\u5c90\u3092\u4ed8\u3051\u308c\u3070\u3088\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u25a0\u7dcf\u30da\u30fc\u30b8\u6570\u304c\u5c11\u306a\u3044\u30eb\u30fc\u30c8<\/p>\n<p>\u691c\u7d22\u7d50\u679c\u304c5\u30da\u30fc\u30b8\u4ee5\u4e0b\u306e\u6642\u3082\u5f53\u7136\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3053\u306e\u6642\u30015\u30da\u30fc\u30b8\u5206\u3082\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u8868\u793a\u3057\u3066\u3044\u3066\u3082\u4e2d\u8eab\u306e\u306a\u3044\u30dc\u30bf\u30f3\u304c\u914d\u7f6e\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u306a\u306e\u3067\u30015\u30da\u30fc\u30b8\u4ee5\u4e0b\u306e\u6642\u306b\u306f\u5b58\u5728\u3059\u308b\u30da\u30fc\u30b8\u5168\u3066\u3092\u4e26\u3079\u305f\u65b9\u304c\u3088\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<div class=\"borderBox\">\n<p>\u25bc\u51684\u30da\u30fc\u30b8\u306e\u6642\u306e\u8868\u793a<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1029\" height=\"82\" data-attachment-id=\"2599\" data-permalink=\"https:\/\/qol-kk.com\/wp2\/blog\/2021\/02\/11\/post-2575\/pagination_03\/\" data-orig-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03.png\" data-orig-size=\"1029,82\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"pagination_03\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-1024x82.png\" class=\"alignnone size-medium wp-image-2599\" src=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03.png\" alt=\"\" srcset=\"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03.png 1029w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-300x24.png 300w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-1024x82.png 1024w, https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2021\/02\/pagination_03-768x61.png 768w\" sizes=\"auto, (max-width: 1029px) 100vw, 1029px\" \/><\/p>\n<\/div>\n<p>\u3053\u306e\u69cb\u9020\u306a\u308938\u30da\u30fc\u30b8\u5206\u306e\u30ea\u30f3\u30af\u304c\u51fa\u6765\u305f\u69cb\u6210\u3010object_list.paginator.page_range \u3092for\u30eb\u30fc\u30d7\u3011\u3067\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u25a01\u30da\u30fc\u30b8\u3057\u304b\u306a\u3044\u30eb\u30fc\u30c8<\/p>\n<p>\u691c\u7d22\u7d50\u679c\u304c1\u4ef6\u306e\u5834\u5408\u3001\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u66f8\u304f\u304b\u3092\u691c\u8a0e\u3057\u307e\u3059\u3002<br \/>\n\u500b\u4eba\u7684\u306b\u306f\u300c\u7121\u304f\u3066\u3044\u3044\u304b\u306a\u300d\u3068\u601d\u3046\u306e\u3067\u30011\u30da\u30fc\u30b8\u3057\u304b\u306a\u3044\u3068\u304d\u306f\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u8868\u793a\u3057\u306a\u3044\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<h4>\u7c21\u5358\u306b\u5b9f\u88c5\u3059\u308b\uff08\u5834\u5408\u5206\u3051\u30d1\u30fc\u30c4\u306e\u307f\u3067\u69cb\u6210\u3057\u3066\u307f\u308b\uff09<\/h4>\n<p>\u4eca\u307e\u3067\u306e\u8003\u5bdf\u3067\u3001\u5206\u5c90\u306e\u30dd\u30a4\u30f3\u30c8\u304c\u660e\u78ba\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<div class=\"paperBox\">\n<ol>\n<li>\u30da\u30fc\u30b8\u7dcf\u6570\u304c1\u3088\u308a\u5927\u304d\u3044\u304b<\/li>\n<li>\u30da\u30fc\u30b8\u7dcf\u6570\u304c6\u4ee5\u4e0a\u304b\u5426\u304b<\/li>\n<li>\u30da\u30fc\u30b8\u7dcf\u6570\u304c6\u4ee5\u4e0a\u306e\u6642\u3001\u73fe\u5728\u306e\u30da\u30fc\u30b8\u756a\u53f7\u306f2\u4ee5\u4e0b\u304b<\/li>\n<li>\u30da\u30fc\u30b8\u7dcf\u6570\u304c6\u4ee5\u4e0a\u306e\u6642\u3001\u73fe\u5728\u306e\u30da\u30fc\u30b8\u756a\u53f7\u306f [ \u6700\u7d42\u9801\uff0d2 ]\u4ee5\u4e0a\u304b<\/li>\n<\/ol>\n<\/div>\n<p>\u3053\u306e\u69cb\u6210\u3067\u5206\u5c90\u306e\u9aa8\u7d44\u307f\u3060\u3051\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">{% load mathfilters %}\r\n{% if object_list.paginator.num_pages &gt; 1 %}\r\n    &lt;!-- 2\u30da\u30fc\u30b8\u4ee5\u4e0a\u3042\u308b\u5834\u5408 --&gt;\r\n    2\u30da\u30fc\u30b8\u4ee5\u4e0a\u3042\u308a\r\n\r\n    {% if object_list.paginator.num_pages &gt; 5 %}\r\n      &lt;!-- \u7dcf\u30da\u30fc\u30b8\u6570\u304c6 \u4ee5\u4e0a --&gt;\r\n      \u203b\u30dc\u30bf\u30f35\u3064\u306e\u69cb\u6210\r\n\r\n        {% if object_list.paginator.num_pages|sub:object_list.number &lt; 2 %}\r\n            &lt;!-- \u6700\u7d42\u30da\u30fc\u30b8\u304b\u3089-2\u30da\u30fc\u30b8\u4ee5\u5185 --&gt;\r\n            \u203b [Last\u30da\u30fc\u30b8-5]\uff5eLast\u30da\u30fc\u30b8\u3092\u4e26\u3079\u308b\r\n            \u203b\u3000\u6700\u7d42\u30da\u30fc\u30b8-\u6700\u7d42\u30da\u30fc\u30b8=0\u306a\u306e\u3067\u3001\u30ab\u30a6\u30f3\u30c80\u304b\u3089\u59cb\u307e\u308b\u305f\u30812\u30da\u30fc\u30b8\u4ee5\u5185\u306f\u300c2\u3088\u308a\u5c0f\u3055\u3044\u300d\u3068\u8868\u73fe\r\n\r\n        {% elif object_list.number &lt; 3 %}\r\n            &lt;!-- \u73fe\u5728\u306e\u30da\u30fc\u30b8\u304c2\u30da\u30fc\u30b8\u4ee5\u5185 --&gt;\r\n            \u203b 1\uff5e5\u3092\u4e26\u3079\u308b\r\n            \u203b \u30da\u30fc\u30b8\u30ab\u30a6\u30f3\u30c8\u306f1\u304b\u3089\u59cb\u307e\u308b\u306e\u30672\u30da\u30fc\u30b8\u4ee5\u5185\u306f\u300c3\u3088\u308a\u5c0f\u3055\u3044\u300d\u3068\u8868\u73fe\r\n\r\n        {% else %}\r\n            &lt;!-- \u73fe\u5728\u306e\u30da\u30fc\u30b8\u304c3\u4ee5\u4e0a\u304b\u3064Last_3\u4ee5\u4e0b --&gt;\r\n            \u203b\u6a19\u6e96\u306e\u30dc\u30bf\u30f3\u00d75\u69cb\u6210\r\n\r\n        {% endif %} \r\n    {% else %}\r\n        &lt;!-- \u7dcf\u30da\u30fc\u30b8\u6570\u304c5\u4ee5\u4e0b --&gt;\r\n        \u203b2\uff5e4\u500b\u306e\u30dc\u30bf\u30f3\u69cb\u6210\r\n\r\n    {% endif %}\r\n{% else %}\r\n    &lt;!-- 1\u30da\u30fc\u30b8\u3057\u304b\u306a\u3044 --&gt;\r\n    \u203b\u3053\u306e\u6642\u306f\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u8868\u793a\u3057\u306a\u3044\r\n{% endif %}<\/pre>\n<h5>\u30c1\u30e7\u30c3\u30c8\u89e3\u8aac<\/h5>\n<p>1\u884c\u76ee\u306b\u3010 {% load mathfilters %} \u3011\u3068\u3044\u3046\u30b3\u30fc\u30c9\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f <a href=\"https:\/\/pypi.org\/project\/django-mathfilters\/\">Django-mathfilters<\/a> \u3068\u3044\u3046\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u6709\u52b9\u5316\u3059\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p>Django-mathfilters \u306fTemplate.html\u5185\u3067\u8a08\u7b97\u3092\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u30da\u30fc\u30b8\u8a08\u7b97\u306e\u969b\u306bJavaScript\u306b\u5024\u3092\u6295\u3052\u3088\u3046\u3068\u8003\u3048\u308b\u5834\u5408\u3001\u3053\u306e\u30b3\u30fc\u30c9\u306f\u4e0d\u8981\u3067\u3059\u3002<br \/>\n\u4e0a\u8a18\u4f8b\u3067Django-mathfilters\u3092\u4f7f\u3063\u3066\u3044\u308b\u500b\u6240\u306f10\u884c\u76ee\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\u5024\u3092\u5165\u308c\u3066\u3057\u3063\u304b\u308a\u5b9f\u88c5\u3057\u3066\u307f\u308b<\/h4>\n<p>\u60f3\u5b9a\u901a\u308a\u52d5\u3044\u305f\u3089\u5b9f\u969b\u306e\u30c7\u30fc\u30bf\u3092\u4ed8\u3051\u8db3\u3057\u3066\u5f62\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u3053\u306e\u6bb5\u968e\u3067\u300e\u7d75\u306b\u63cf\u3044\u305f\u9905\u3067\u306f\u306a\u304b\u3063\u305f\u304b\u300f\u300e\u98df\u3079\u308c\u308b\u9905\u306b\u3059\u308b\u305f\u3081\u306b\u4f55\u304c\u5fc5\u8981\u304b\u300f\u304c\u660e\u78ba\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4e0a\u306e\u6bb5\u968e\u3067\u5b58\u5728\u3057\u306a\u304b\u3063\u305f\u3010\u5148\u982d\u306b\u79fb\u52d5\u3011\u3010\u672b\u5c3e\u306b\u79fb\u52d5\u3011\u3092\u4ed8\u3051\u52a0\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u25a0\u5148\u982d\u306b\u79fb\u52d5\u3059\u308b<\/p>\n<pre class=\"lang:default decode:true\">&lt;!-- \u5148\u982d\u306b\u79fb\u52d5 --&gt;\r\n    &lt;a href=\"{% url 'Hoge:hoge_list' num=1 %}?{{get_request}}\"&gt;\r\n        &lt;span&gt;&amp;laquo;&lt;\/span&gt;\r\n    &lt;\/a&gt;<\/pre>\n<p>\u25a0\u672b\u5c3e\u306b\u79fb\u52d5\u3059\u308b<\/p>\n<pre class=\"lang:default decode:true\">&lt;!-- \u672b\u5c3e\u306b\u79fb\u52d5 --&gt;\r\n    &lt;a href=\"{% url 'Hoge:hoge_list' num=object_list.paginator.num_pages %}?{{get_request}}\"&gt;\r\n        &lt;span&gt;&amp;laquo;&lt;\/span&gt;\r\n    &lt;\/a&gt;<\/pre>\n<p>\u901a\u5e38\u3060\u3068\u3053\u3093\u306a\u5e9c\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u5171\u6709(include\u3067\u8907\u6570\u30da\u30fc\u30b8\u3067\u4f7f\u3044\u307e\u308f\u3059)\u3057\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u308b\u306e\u306b {% url ' Hoge:hoge_list' %}\u3068\u9077\u79fb\u5148\u3092\u6307\u5b9a\u3057\u3066\u3044\u305f\u3089\u5171\u6709\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u305d\u3053\u3067\u30a2\u30a4\u30c7\u30a3\u30a2\u3092\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p>\u300cView\u3067\u5171\u901a\u306e\u5f62\u306b\u3057\u3066Template\u3067\u8aad\u307f\u8fbc\u307e\u305b\u308b\u3068\u3069\u3046\u3060\u308d\u3046\u304b...\u300d<\/p>\n<pre class=\"lang:default decode:true\">#view\r\n  \"\"\" URL\u306e\u30ea\u30f3\u30af\u540d\u3092\u300cl_page\u300d\u306b\u3057\u3066\u9001\u308b \"\"\"\r\n    params = {\r\n      ....\r\n        'l_page': 'Hoge:hoge_list'\r\n    }<\/pre>\n<pre class=\"lang:default decode:true\">&lt;!-- Template(paginatore) --&gt;\r\n    &lt;a href=\"{% url l_page num=1 %}?{{get_request}}\"&gt;\r\n        &lt;span&gt;&amp;laquo;&lt;\/span&gt;\r\n    &lt;\/a&gt;<\/pre>\n<p>\u4e0a\u624b\u304f\u52d5\u304d\u307e\u3057\u305f\u3002\u3053\u306e\u30a2\u30a4\u30c7\u30a3\u30a2\u3067\u554f\u984c\u306a\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>CSS\u306a\u3069\u3082\u3053\u306e\u6bb5\u968e\u3067\u3064\u3051\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u81ea\u5206\u3067\u4f5c\u308b\u306e\u3082\u9762\u5012\u306a\u306e\u3067\u3001\u6ca2\u5c71\u306e\u826f\u3055\u3052\u306a\u30c7\u30b6\u30a4\u30f3\u30b5\u30a4\u30c8\u3055\u3093\u304b\u3089\u6d41\u7528\u3055\u305b\u3066\u3082\u3089\u3063\u3066\u53d6\u308a\u4ed8\u3051\u308b\u3068\u3001Code\u306f\u3053\u3093\u306a\u59ff\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:default decode:true\">{% load mathfilters %}\r\n{% if object_list.paginator.num_pages &gt; 1 %}\r\n&lt;!-- 2\u30da\u30fc\u30b8\u4ee5\u4e0a\u3042\u308b\u5834\u5408 --&gt;\r\n&lt;div class=\"pager\"&gt;\r\n  &lt;ul class=\"pagination\"&gt;\r\n    &lt;li class=\"pre\"&gt;\r\n      &lt;a href=\"{% url l_page num=1 %}?{{get_request}}\"&gt;\r\n        &lt;span&gt;&amp;laquo;&lt;\/span&gt;\r\n      &lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n    {% if object_list.paginator.num_pages &gt; 5 %}\r\n      &lt;!-- \u7dcf\u30da\u30fc\u30b8\u6570\u304c6\u4ee5\u4e0a --&gt;\r\n      {% if object_list.paginator.num_pages|sub:object_list.number &lt; 2 %}\r\n        &lt;!-- \u73fe\u5728\u304c\u6700\u7d42\u30da\u30fc\u30b8\u304b\u30892\u30da\u30fc\u30b8\u4ee5\u5185 --&gt;\r\n        {% with ''|center:5 as range %}\r\n          {% for list in range %}\r\n            {% if object_list.paginator.num_pages|sub:4|add:forloop.counter0 == object_list.number %}\r\n              &lt;li&gt;\r\n                &lt;a class=\"active\" href=\"{% url l_page num=object_list.paginator.num_pages|sub:4|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.paginator.num_pages|sub:4|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% else %}\r\n              &lt;li&gt;\r\n                &lt;a href=\"{% url l_page num=object_list.paginator.num_pages|sub:4|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.paginator.num_pages|sub:4|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% endif %}\r\n          {% endfor %}\r\n        {% endwith %}\r\n      {% elif object_list.number &lt; 3 %}\r\n        &lt;!-- \u73fe\u5728\u304c\u5148\u982d\u304b\u30892\u30da\u30fc\u30b8\u4ee5\u5185 --&gt;\r\n        {% with ''|center:5 as range %}\r\n          {% for list in range %}\r\n            {% if forloop.counter == object_list.number %}\r\n              &lt;li&gt;\r\n                &lt;a class=\"active\" href=\"{% url l_page num=forloop.counter %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{forloop.counter}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% else %}\r\n              &lt;li&gt;\r\n                &lt;a href=\"{% url l_page num=forloop.counter %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{forloop.counter}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% endif %}\r\n          {% endfor %}\r\n        {% endwith %}\r\n      {% else %}\r\n        &lt;!-- \u73fe\u5728\u306e\u30da\u30fc\u30b8\u304c3\u4ee5\u4e0a\u304b\u3064Last_3\u4ee5\u4e0b --&gt;\r\n        {% with ''|center:5 as range %}\r\n          {% for list in range %}\r\n            {% if object_list.number|sub:2|add:forloop.counter0 == object_list.number %}\r\n              &lt;li&gt;\r\n                &lt;a class=\"active\" href=\"{% url l_page num=object_list.number|sub:2|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.number|sub:2|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% else %}\r\n              &lt;li&gt;\r\n                &lt;a href=\"{% url l_page num=object_list.number|sub:2|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.number|sub:2|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% endif %}\r\n          {% endfor %}\r\n        {% endwith %}\r\n      {% endif %}\r\n    {% else %}\r\n      &lt;!-- \u7dcf\u30da\u30fc\u30b8\u6570\u304c5\u4ee5\u4e0b --&gt;\r\n      {% for page_num in object_list.paginator.page_range %}\r\n        {% if object_list.number == page_num %}\r\n          &lt;li&gt;\r\n            &lt;a href=\"{% url l_page num=page_num %}?{{get_request}}\" class=\"active\"&gt;\r\n              &lt;span&gt;{{page_num}}&lt;\/span&gt;\r\n            &lt;\/a&gt;\r\n          &lt;\/li&gt;\r\n        {% else %}\r\n          &lt;li&gt;\r\n            &lt;a href=\"{% url l_page num=page_num %}?{{get_request}}\"&gt;\r\n              &lt;span&gt;{{page_num}}&lt;\/span&gt;\r\n            &lt;\/a&gt;\r\n          &lt;\/li&gt;\r\n        {% endif %}\r\n      {% endfor%}\r\n    {% endif %}\r\n\r\n    &lt;li class=\"last\"&gt;\r\n        &lt;a href=\"{% url l_page object_list.paginator.num_pages %}?{{get_request}}\"&gt;\r\n          &lt;span&gt;&amp;raquo;&lt;\/span&gt;\r\n        &lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n  &lt;\/ul&gt;\r\n&lt;\/div&gt;\r\n{% endif %}<\/pre>\n<p>\u3044\u3044\u611f\u3058\u306b\u5b9f\u88c5\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h5>\u30c1\u30e7\u30c3\u30c8\u89e3\u8aac [Template\u3067\u306e for i~ \u30eb\u30fc\u30d7]<\/h5>\n<pre class=\"lang:default decode:true\">{% with ''|center:5 as range %}\r\n\u3000\u3000{% for list in range %}\r\n      {{ forloop.counter0 }}\r\n      {{ forloop.counter }}\r\n    {% endfor %}\r\n{% endwith %}<\/pre>\n<p>\u4eca\u56de\u3053\u3093\u306a\u5f62\u3067\u66f8\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u306f\u3001with \u3067\u7e70\u8fd4\u3057\u306e\u56de\u6570\u5206\u306e\u7a7a\u30ea\u30b9\u30c8\uff08[ '','','','','']\uff09\u3092\u4f5c\u6210\u3002for\u3067\u56de\u305b\u3070\u6b32\u3057\u3044\u56de\u6570\u3060\u3051\u30eb\u30fc\u30d7\u3057\u3066\u304f\u308c\u308b\u3068\u3044\u3046\u624b\u6cd5\u3067\u3059\u3002<br \/>\n\u7e70\u308a\u8fd4\u3057\u305f\u56de\u6570\u306f {{ forloop.counter0 }}=\u30bc\u30ed\u304b\u3089\u30ab\u30a6\u30f3\u30c8\u3001{{ forloop.counter }}=1\u304b\u3089\u30ab\u30a6\u30f3\u30c8\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:php decode:true \">{% for list in object_list.paginator.page_range|slice:\"(object_list.number|sub:2):(object_list.number|add:2)\" %}\r\n  #\"(object_list.number|sub:2):(object_list.number|add:2)\"\u3000\u306e\u7b87\u6240\u306f\u53d6\u308a\u51fa\u3059\u30ec\u30f3\u30b8\u3067 slice:\"5:9\" \u3068\u3044\u3046\u59ff\u3092\u4f5c\u308d\u3046\u3068\u3057\u3066\u3044\u308b\r\n    &lt;li&gt;\r\n        &lt;a href=\"{% url l_page num=list %}?{{get_request}}\"&gt;\r\n            &lt;span&gt;{{list}}&lt;\/span&gt;\r\n        &lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n{% endfor %}<\/pre>\n<p>With\u306a\u3093\u3066\u4f7f\u308f\u306a\u304f\u3066\u3082renge\u6307\u5b9a\u306efor\u30eb\u30fc\u30d7\u3067\u53d6\u308a\u51fa\u305b\u308b\u3068\u601d\u3063\u305f\u306e\u3067\u3059\u304c\u3001slice\u306e\u6307\u5b9a\u306b\u8a08\u7b97\u5f0f\u3092\u5165\u308c\u308b\u5fc5\u8981\u304c\u3042\u308a\u610f\u56f3\u3057\u305f\u59ff\u306b\u5b9f\u88c5\u3059\u308b\u4e8b\u304c\u51fa\u6765\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<h4>\u7d30\u304b\u306a\u4fee\u6b63<\/h4>\n<p>\u4f7f\u3063\u3066\u307f\u308b\u3068\u30c7\u30b6\u30a4\u30f3\u7684\u306b\u300c\u3061\u3087\u3063\u3068\u306a\u300d\u3068\u601d\u3046\u7b87\u6240\u304c\u51fa\u3066\u304d\u307e\u3059\u3002<br \/>\n\u4e0a\u306b\u8a18\u3057\u305fScript\u3060\u3068\u3053\u3093\u306a\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<div class=\"paperBox\">\n<ol>\n<li>1\u30da\u30fc\u30b8\u76ee\u3084\u30e9\u30b9\u30c8\u30da\u30fc\u30b8\u306e\u6642\u306b\u3010\u5148\u982d\u3078\u79fb\u52d5\u3011\u3010Last\u3078\u79fb\u52d5\u3011\u3092 class=\"active\"\u306b\u3057\u305f\u65b9\u304c\u826f\u3044<\/li>\n<li>\u6700\u7d42\u30da\u30fc\u30b8\u304c\u4f55\u30da\u30fc\u30b8\u304b\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u3001Last\u3078\u79fb\u52d5\u306f \u00bb \u3067\u8868\u3059\u3088\u308a\u30da\u30fc\u30b8\u6570\u304c\u826f\u3044\u304b\u3082<\/li>\n<li>\u30c7\u30b6\u30a4\u30f3\u7684\u306b\u5148\u982d\u3078\u79fb\u52d5\u3068Last\u3078\u79fb\u52d5\u306e\u30eb\u30fc\u30eb\u306f\u5171\u901a\u304c\u826f\u3044\uff08\u7247\u65b9\u3060\u3051\u226a\u8868\u8a18\u3068\u304b\u306f\u30ab\u30c3\u30b3\u60aa\u3044\uff09<\/li>\n<\/ol>\n<\/div>\n<p>\u4fee\u6b63\u7a3f\u304c\u3053\u3061\u3089(paginator.html)<\/p>\n<pre class=\"lang:php decode:true \">{% load mathfilters %}\r\n{% if object_list.paginator.num_pages &gt; 1 %}\r\n&lt;div class=\"pager\"&gt;\r\n  &lt;ul class=\"pagination\"&gt;\r\n    &lt;li class=\"pre\"&gt;\r\n      {% if object_list.number == 1 %}\r\n      &lt;a class=\"active\" href=\"{% url l_page num=1 %}?{{get_request}}\"&gt;\r\n        &lt;span&gt;&amp;laquo;&lt;\/span&gt;\r\n      &lt;\/a&gt;\r\n      {% elif object_list.number &lt; 4 %}\r\n      &lt;a href=\"{% url l_page num=1 %}?{{get_request}}\"&gt;\r\n        &lt;span&gt;&amp;laquo;&lt;\/span&gt;\r\n      &lt;\/a&gt;\r\n      {% else %}\r\n      &lt;a href=\"{% url l_page num=1 %}?{{get_request}}\"&gt;\r\n        &lt;span&gt;1&lt;\/span&gt;\r\n      &lt;\/a&gt;\r\n      {% endif %}\r\n    &lt;\/li&gt;\r\n    {% if object_list.paginator.num_pages &gt; 5 %}\r\n      {% if object_list.paginator.num_pages|sub:object_list.number &lt; 2 %}\r\n        {% with ''|center:5 as range %}\r\n          {% for list in range %}\r\n            {% if object_list.paginator.num_pages|sub:4|add:forloop.counter0 == object_list.number %}\r\n              &lt;li&gt;\r\n                &lt;a class=\"active\" href=\"{% url l_page num=object_list.paginator.num_pages|sub:4|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.paginator.num_pages|sub:4|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% else %}\r\n              &lt;li&gt;\r\n                &lt;a href=\"{% url l_page num=object_list.paginator.num_pages|sub:4|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.paginator.num_pages|sub:4|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% endif %}\r\n          {% endfor %}\r\n        {% endwith %}\r\n      {% elif object_list.number &lt; 3 %}\r\n        {% with ''|center:5 as range %}\r\n          {% for list in range %}\r\n            {% if forloop.counter == object_list.number %}\r\n              &lt;li&gt;\r\n                &lt;a class=\"active\" href=\"{% url l_page num=forloop.counter %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{forloop.counter}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% else %}\r\n              &lt;li&gt;\r\n                &lt;a href=\"{% url l_page num=forloop.counter %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{forloop.counter}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% endif %}\r\n          {% endfor %}\r\n        {% endwith %}\r\n      {% else %}\r\n        {% with ''|center:5 as range %}\r\n          {% for list in range %}\r\n            {% if object_list.number|sub:2|add:forloop.counter0 == object_list.number %}\r\n              &lt;li&gt;\r\n                &lt;a class=\"active\" href=\"{% url l_page num=object_list.number|sub:2|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.number|sub:2|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% else %}\r\n              &lt;li&gt;\r\n                &lt;a href=\"{% url l_page num=object_list.number|sub:2|add:forloop.counter0 %}?{{get_request}}\"&gt;\r\n                  &lt;span&gt;{{object_list.number|sub:2|add:forloop.counter0}}&lt;\/span&gt;\r\n                &lt;\/a&gt;\r\n              &lt;\/li&gt;\r\n            {% endif %}\r\n          {% endfor %}\r\n        {% endwith %}\r\n      {% endif %}\r\n    {% else %}\r\n      {% for page_num in object_list.paginator.page_range %}\r\n        {% if object_list.number == page_num %}\r\n          &lt;li&gt;\r\n            &lt;a href=\"{% url l_page num=page_num %}?{{get_request}}\" class=\"active\"&gt;\r\n              &lt;span&gt;{{page_num}}&lt;\/span&gt;\r\n            &lt;\/a&gt;\r\n          &lt;\/li&gt;\r\n        {% else %}\r\n          &lt;li&gt;\r\n            &lt;a href=\"{% url l_page num=page_num %}?{{get_request}}\"&gt;\r\n              &lt;span&gt;{{page_num}}&lt;\/span&gt;\r\n            &lt;\/a&gt;\r\n          &lt;\/li&gt;\r\n        {% endif %}\r\n      {% endfor%}\r\n    {% endif %}\r\n    &lt;li class=\"last\"&gt;\r\n      {% if object_list.number == object_list.paginator.num_pages %}\r\n        &lt;a class=\"active\" href=\"{% url l_page object_list.paginator.num_pages %}?{{get_request}}\"&gt;\r\n          &lt;span&gt;&amp;raquo;&lt;\/span&gt;\r\n        &lt;\/a&gt;\r\n      {% elif object_list.paginator.num_pages|sub:object_list.number &lt; 3 %}\r\n        &lt;a href=\"{% url l_page object_list.paginator.num_pages %}?{{get_request}}\"&gt;\r\n          &lt;span&gt;&amp;raquo;&lt;\/span&gt;\r\n        &lt;\/a&gt;\r\n      {% else %}\r\n        &lt;a href=\"{% url l_page object_list.paginator.num_pages %}?{{get_request}}\"&gt;\r\n          &lt;span&gt;{{object_list.paginator.num_pages}}&lt;\/span&gt;\r\n        &lt;\/a&gt;\r\n      {% endif %}\r\n    &lt;\/li&gt;\r\n  &lt;\/ul&gt;\r\n&lt;\/div&gt;\r\n{% endif %}<\/pre>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306b\u306f\u3044\u308d\u3093\u306a\u3084\u308a\u65b9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u304a\u5ba2\u3055\u3093\u306b\u3088\u3063\u3066\u8981\u671b\u304c\u7570\u306a\u308b\u3053\u3068\u3082\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u305d\u3093\u306a\u6642\u3001\u81ea\u5206\u3067\u4f5c\u308c\u308c\u3070\u3069\u3046\u3068\u3067\u3082\u5bfe\u51e6\u3067\u304d\u308b\u306e\u3067 django.core.paginator \u3067\u306e\u69cb\u7bc9\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u4e00\u500b\u4f5c\u308c\u3070\u5f8c\u306f include \u3059\u308b\u3060\u3051\u3063\u3066\u697d\u3067\u3059\u3088\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Django\uff1a\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306e\u30da\u30fc\u30b8\u756a\u53f7\u3092\u826f\u3044\u611f\u3058\u3067\u7e2e\u3081\u308b\u65b9\u6cd5 \u5148\u56de\u306e\u8a18\u4e8b\u3067\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306e\u5927\u67a0\u306b\u3064\u3044\u3066\u306f\u8a18\u8f09\u3057\u307e\u3057\u305f\u3002 \u4eca\u56de\u306f\u3053\u306e\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u826f\u3044\u611f\u3058\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3067\u3059\u3002 \u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u306f1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2174,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[38],"tags":[814,920,147,97,53,238,921],"class_list":["post-2575","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-memorandum","tag-django","tag-paginator","tag-python","tag-97","tag-53","tag-238","tag-921"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2020\/11\/django.png","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/2575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=2575"}],"version-history":[{"count":0,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/2575\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/2174"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=2575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=2575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=2575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}