{"id":697,"date":"2009-04-11T20:52:10","date_gmt":"2009-04-11T11:52:10","guid":{"rendered":"http:\/\/www.ic-tact.co.jp\/?p=697"},"modified":"2009-04-11T20:54:55","modified_gmt":"2009-04-11T11:54:55","slug":"django-%e7%ae%a1%e7%90%86%e7%94%bb%e9%9d%a2%e4%bd%9c%e6%88%90%e3%81%a7%e3%83%8f%e3%83%9e%e3%82%8b","status":"publish","type":"post","link":"http:\/\/www.ic-tact.co.jp\/?p=697","title":{"rendered":"Django \u7ba1\u7406\u753b\u9762\u4f5c\u6210\u3067\u30cf\u30de\u308b"},"content":{"rendered":"<p>\u6280\u8853\u30cd\u30bf\u3067\u3059\u3002\u30cf\u30de\u3063\u305f\u306e\u3067\u5099\u5fd8\u9332\u7684\u306b\u8a18\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.djangoproject.com\/\">Django<\/a> \u3068\u3044\u3046 <a href=\"http:\/\/www.python.org\/\">Python<\/a> \u88fd\u306e\u30a6\u30a7\u30d6\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067 hdknr \u3055\u3093\u3068\u3086\u3063\u304f\u308a\u306a\u304c\u3089\u52c9\u5f37\u517c\u306d\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u7ba1\u7406\u753b\u9762\u306e\u6a5f\u80fd\u304c\u3088\u304f\u3067\u304d\u3066\u304a\u308a\u3001\u73fe\u5728\u7ba1\u7406\u753b\u9762\u3092\u4f5c\u6210\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u30cf\u30de\u308a\u307e\u304f\u3063\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u7ba1\u7406\u753b\u9762\u3067\u30e6\u30fc\u30b6\u30fc(author)\u306e\u30d5\u30a3\u30eb\u30bf(list_filter)\u3092\u4f7f\u3044\u305f\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u7ba1\u7406\u753b\u9762\u306b\u306f\u8868\u793a\u3055\u308c\u305a\u3002\u30e6\u30fc\u30b6\u30fc\u30d5\u30a3\u30fc\u30eb\u30c9\u306f ForeignKey \u3067\u5916\u90e8\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u6301\u3063\u3066\u304d\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3067\u3057\u305f\u3002<a href=\"http:\/\/djangoproject.jp\/doc\/ja\/1.0\/ref\/contrib\/admin.html#list-filter\">Django \u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u898b\u3066\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u306f\u305a\u306a\u306e\u3067\u8868\u793a\u3055\u308c\u306a\u3044\u306e\u306f\u304a\u304b\u3057\u3044\uff01\u3000\u3068\u601d\u3063\u3066\u3042\u308c\u3053\u308c\u60a9\u3093\u3067\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u5358\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e admin \u4ee5\u5916\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u3044\u306a\u304b\u3063\u305f\u3060\u3051\u3068\u3044\u3046\u30aa\u30c1\u3002\u3053\u3053\u3067\u30cf\u30de\u308b\u4eba\u306f\u4f59\u308a\u3044\u306a\u3044\u3093\u3067\u3059\u304b\u306d\u3047\u3002\u30e6\u30fc\u30b6\u30fc\u8ffd\u52a0\u3057\u305f\u3089\u3042\u3063\u3055\u308a\u30d5\u30a3\u30eb\u30bf\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306b\u306a\u3063\u3066\u307e\u3059\u3002<\/p>\n<blockquote><p>\nclass NoteOptions(admin.ModelAdmin):<br \/>\n    list_display = (&#8216;id&#8217;,&#8217;author&#8217;,&#8217;text&#8217;,&#8217;writed_at&#8217;,&#8217;votes&#8217;,&#8217;status&#8217;,&#8217;selected_tags&#8217;)<br \/>\n    date_hierarchy = &#8216;writed_at&#8217;<br \/>\n    list_filter = (&#8216;author&#8217;,&#8217;writed_at&#8217;,&#8217;status&#8217;,&#8217;tags&#8217;)<br \/>\n    search_fields = [&#8216;text&#8217;,&#8217;author__username&#8217;]<br \/>\n    filter_horizontal = [&#8216;tags&#8217;]\n<\/p><\/blockquote>\n<p>\u3064\u3065\u3044\u3066\u30cf\u30de\u3063\u305f\u306e\u304c\u3084\u306f\u308a\u7ba1\u7406\u753b\u9762\u3067 search_fields \u3067\u3059\u3002author \u3092\u691c\u7d22\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001author \u3092\u8ffd\u52a0\u3057\u3066\u3082\u691c\u7d22\u3067\u304d\u305a\u3002\u3053\u3061\u3089\u306f<a href=\"http:\/\/djangoproject.jp\/doc\/ja\/1.0\/ref\/contrib\/admin.html#search-fields\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u898b\u305f\u3089\u3042\u3063\u3055\u308a\u7b54\u3048\u304c\u66f8\u3044\u3066\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<blockquote><p>\n\u30d5\u30a3\u30fc\u30eb\u30c9\u306f CharField \u3084 TextField \u306e\u3088\u3046\u306a\u4f55\u3089\u304b\u306e\u30c6\u30ad\u30b9\u30c8\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002 DB API \u306e\u300c\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u8ffd\u8de1\u3059\u308b\u300d\u8868\u8a18\u3092\u4f7f\u3048\u3070\u3001 ForeignKey \u3092\u4ecb\u3057\u305f\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u6307\u5b9a\u3082\u884c\u3048\u307e\u3059:<\/p>\n<p>search_fields = [&#8216;foreign_key__related_fieldname&#8217;]\n<\/p><\/blockquote>\n<p>\u5b9f\u969b\u306e\u30b3\u30fc\u30c9\u306f\u524d\u8ff0\u306e\u3082\u306e\u3068\u540c\u3058\u3067\u3059\u3002&#8221;__&#8221;\u3067\u7e4b\u3052\u308b\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u30c8\u30e9\u30a4\uff06\u30a8\u30e9\u30fc\u3092\u7e70\u308a\u8fd4\u3057\u3064\u3064\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u5f53\u305f\u3063\u305f\u308a\u306a\u3069\u3057\u3066\u89e3\u6c7a\u3067\u304d\u307e\u3057\u305f\u3002\u6642\u9593\u306f\u304b\u304b\u3063\u305f\u3051\u3069\u305d\u306e\u5206\u7406\u89e3\u3082\u3067\u304d\u307e\u3057\u305f\u3002\u8eab\u306b\u7740\u3051\u308b\u3053\u3068\u304c\u7b2c\u4e00\u76ee\u6a19\u306a\u306e\u3067\u6642\u9593\u304b\u304b\u3063\u305f\u3051\u3069\u6c17\u306b\u3057\u306a\u3044\u3002Django \u306f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u304c\u3057\u3063\u304b\u308a\u3057\u3066\u3044\u308b\u306e\u3067\u52a9\u304b\u308a\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u8ffd\u8a18\u3002<\/p>\n<p>\u30b3\u30fc\u30c9\u306e\u30a4\u30f3\u30c7\u30f3\u30c8\u304c\u3055\u308c\u307e\u305b\u3093\u306d\u3002<a href=\"http:\/\/wppluginsj.sourceforge.jp\/syntax-highlighter\/\">Syntax-Highlighter<\/a> \u8fba\u308a\u3092\u5165\u308c\u305f\u307b\u3046\u304c\u3044\u3044\u304b\u306a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6280\u8853\u30cd\u30bf\u3067\u3059\u3002\u30cf\u30de\u3063\u305f\u306e\u3067\u5099\u5fd8\u9332\u7684\u306b\u8a18\u3057\u307e\u3059\u3002 Django \u3068\u3044\u3046 Python \u88fd\u306e\u30a6\u30a7\u30d6\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067 hdknr \u3055\u3093\u3068\u3086\u3063\u304f\u308a\u306a\u304c\u3089\u52c9\u5f37\u517c\u306d\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u7ba1\u7406\u753b\u9762\u306e\u6a5f\u80fd\u304c\u3088\u304f\u3067\u304d\u3066\u304a\u308a\u3001 [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/697"}],"collection":[{"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=697"}],"version-history":[{"count":4,"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/697\/revisions"}],"predecessor-version":[{"id":700,"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/697\/revisions\/700"}],"wp:attachment":[{"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=697"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ic-tact.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}