... porter オブジェクトを使って Article を作成する: >>> new_article = r . article_set . create ( ... headline = "John's second story" , pub_date = date ( 2005 , 7 , 29 ) ... ) >>> new_article <Article: John's second story> >>> new_article . reporter <Repo ... new_article . reporter . id 1 新しい記事を作成する: >>> new_article2 = Article . objects . create ( ... headline = "Paul's story" , pub_date = date ( 2006 , 1 , 17 ), reporter = r ... ) >>> new_article2 . reporter <Reporter: John Smith> >>> new_articl ... e2 . reporter . id 1 >>> r . article_set . all () <QuerySet [<Article: John's second story>, <Article: Paul's story>, <Article: This is a test>]> 同じ記事を別の記事セットに追加する - 移動することを確認します: >>> ... ... porter オブジェクトを使って Article を作成する: >>> new_article = r . article_set . create ( ... headline = "John's second story" , pub_date = date ( 2005 , 7 , 29 ) ... ) >>> new_article <Article: John's second story> >>> new_article . reporter <Repo ... new_article . reporter . id 1 新しい記事を作成する: >>> new_article2 = Article . objects . create ( ... headline = "Paul's story" , pub_date = date ( 2006 , 1 , 17 ), reporter = r ... ) >>> new_article2 . reporter <Reporter: John Smith> >>> new_articl ... e2 . reporter . id 1 >>> r . article_set . all () <QuerySet [<Article: John's second story>, <Article: Paul's story>, <Article: This is a test>]> 同じ記事を別の記事セットに追加する - 移動することを確認します: >>> ... ... t" , ], }, { "BACKEND" : "django.template.backends.jinja2.Jinja2" , "DIRS" : [ "/home/html/jinja2" , ], }, ] get_template('story_detail.html') を呼び出した場合、Django は次の順番にファイルを探します。 /home/html/example.com/story_detail.html ( 'django ... ' エンジン) /home/html/default/story_detail.html ( 'django' エンジン) /home/html/jinja2/story_detail.html ( 'jinja2' エンジン) select_template(['story_253_deta ... il.html', 'story_detail.html']) を呼び出した場合、Djangoは以下の順番にファイルを探します。 /home/html/example.com/story_253_detail.html ( ' ... ... t" , ], }, { "BACKEND" : "django.template.backends.jinja2.Jinja2" , "DIRS" : [ "/home/html/jinja2" , ], }, ] get_template('story_detail.html') を呼び出した場合、Django は次の順番にファイルを探します。 /home/html/example.com/story_detail.html ( 'django ... ' エンジン) /home/html/default/story_detail.html ( 'django' エンジン) /home/html/jinja2/story_detail.html ( 'jinja2' エンジン) select_template(['story_253_deta ... il.html', 'story_detail.html']) を呼び出した場合、Djangoは以下の順番にファイルを探します。 /home/html/example.com/story_253_detail.html ( ' ... ... .html" %} {% block title %}{{ section.title }}{% endblock %} {% block content %} < h1 > {{ section.title }} </ h1 > {% for story in story_list %} < h2 > < a href = " {{ story.get_absolute_url }} " > {{ story.headline | upper }} </ a > </ h2 > < p > {{ ... story.tease | truncatewords :"100" }} </ p > {% endfor %} {% endblock %} 設計思想 なぜ、(ZopeのTALのような) XMLベースのテンプレー ... ... .html" %} {% block title %}{{ section.title }}{% endblock %} {% block content %} < h1 > {{ section.title }} </ h1 > {% for story in story_list %} < h2 > < a href = " {{ story.get_absolute_url }} " > {{ story.headline | upper }} </ a > </ h2 > < p > {{ ... story.tease | truncatewords :"100" }} </ p > {% endfor %} {% endblock %} 設計思想 なぜ、(ZopeのTALのような) XMLベースのテンプレー ... ... ssThan ( F ( "word_count" ), 7500 )) ...下記のように、アノテーションでも使用できます: Book . objects . annotate ( is_short_story = LessThan ( F ( "word_count" ), 7500 )) lhs ¶ 左辺 - ルックアップされる対象。オブジェクトは通常 クエリ式API に従います。プ ... ... ssThan ( F ( "word_count" ), 7500 )) ...下記のように、アノテーションでも使用できます: Book . objects . annotate ( is_short_story = LessThan ( F ( "word_count" ), 7500 )) lhs ¶ 左辺 - ルックアップされる対象。オブジェクトは通常 クエリ式API に従います。プ ... ... self , request , queryset ): updated = queryset . update ( status = "p" ) self . message_user ( request , ngettext ( " %d story was successfully marked as published." , " %d stories were successfully marked as published." , updated , ) % updated , me ... ... with a foreign key to ContentType ; this lets Permission represent concepts like "can add blog entry" or "can delete news story". ContentTypeManager ¶ class ContentTypeManager [ソース] ¶ ContentType にはカスタムマネージャー ContentTypeManager もあり、 ... 2026年10月08日