... う。通常はこのようにします: # Tintin filed a news story! reporter = Reporters . objects . get ( name = "Tintin" ) reporter . stories_filed += 1 reporter . save () ここでは、 reporter.stories_filed の値をデータベースからメモリに取り込んで、Pythonでおなじみ ... ようにすることもできます: from django.db.models import F reporter = Reporters . objects . get ( name = "Tintin" ) reporter . stories_filed = F ( "stories_filed" ) + 1 reporter . save () reporter.stories_filed = F('stories_filed') + 1 はインスタンス属性に値 ... F() インスタンスを見つけると、標準のPython演算子をオーバーライドしてカプセル化されたSQL式を作成します。この場合、 reporter.stories_filed によって表されるデータベースフィールドをインクリメントするようにデータベースに指示する式が作成されます。 reporter.st ... ... う。通常はこのようにします: # Tintin filed a news story! reporter = Reporters . objects . get ( name = "Tintin" ) reporter . stories_filed += 1 reporter . save () ここでは、 reporter.stories_filed の値をデータベースからメモリに取り込んで、Pythonでおなじみ ... ようにすることもできます: from django.db.models import F reporter = Reporters . objects . get ( name = "Tintin" ) reporter . stories_filed = F ( "stories_filed" ) + 1 reporter . save () reporter.stories_filed = F('stories_filed') + 1 はインスタンス属性に値 ... F() インスタンスを見つけると、標準のPython演算子をオーバーライドしてカプセル化されたSQL式を作成します。この場合、 reporter.stories_filed によって表されるデータベースフィールドをインクリメントするようにデータベースに指示する式が作成されます。 reporter.st ... ... 人にやさしい名前をつけることができます: from django.contrib import admin ... @admin . action ( description = "Mark selected stories as published" ) def make_published ( modeladmin , request , queryset ): queryset . update ( status = "p" ) 注釈 これには見 ... になります: from django.contrib import admin from myapp.models import Article @admin . action ( description = "Mark selected stories as published" ) def make_published ( modeladmin , request , queryset ): queryset . update ( status = "p" ) class ArticleAd ... ass ArticleAdmin ( admin . ModelAdmin ): ... actions = [ "make_published" ] @admin . action ( description = "Mark selected stories as published" ) def make_published ( self , request , queryset ): queryset . update ( status = "p" ) まず make_published を ... ... 人にやさしい名前をつけることができます: from django.contrib import admin ... @admin . action ( description = "Mark selected stories as published" ) def make_published ( modeladmin , request , queryset ): queryset . update ( status = "p" ) 注釈 これには見 ... になります: from django.contrib import admin from myapp.models import Article @admin . action ( description = "Mark selected stories as published" ) def make_published ( modeladmin , request , queryset ): queryset . update ( status = "p" ) class ArticleAd ... ass ArticleAdmin ( admin . ModelAdmin ): ... actions = [ "make_published" ] @admin . action ( description = "Mark selected stories as published" ) def make_published ( self , request , queryset ): queryset . update ( status = "p" ) まず make_published を ... ... い。 You can use select_template() for flexible template loading. For example, if you've written a news story and want some stories to have custom templates, use something like select_template(['story_%s_detail.html' % story.id, 'story_detail.html']) . T ... hat'll allow you to use a custom template for an individual story, with a fallback template for stories that don't have custom templates. テンプレートを含む各ディレクトリの中のサブディレクトリにテンプレートを整理することは可能 ... ... い。 You can use select_template() for flexible template loading. For example, if you've written a news story and want some stories to have custom templates, use something like select_template(['story_%s_detail.html' % story.id, 'story_detail.html']) . T ... hat'll allow you to use a custom template for an individual story, with a fallback template for stories that don't have custom templates. テンプレートを含む各ディレクトリの中のサブディレクトリにテンプレートを整理することは可能 ... ... ケーションであっても異なるコンテキストによってURLが異なるものになることを許容すべきです。例えば、ストーリーに関するページを /stories/ に配置し、別のページでは /news/ を使うかもしれません。 無限の柔軟性 ¶ URLは可能な限り柔軟性を持たせています。考えうる URL ... ... case になります。 verbose_name_plural ¶ Options. verbose_name_plural ¶ オブジェクトの名前の複数形: verbose_name_plural = "stories" 指定されない場合、 Django は verbose_name + "s" を使用します。 読み取り専用の Meta 属性 ¶ label ¶ Options. label ¶ オブジ ... ... ケーションであっても異なるコンテキストによってURLが異なるものになることを許容すべきです。例えば、ストーリーに関するページを /stories/ に配置し、別のページでは /news/ を使うかもしれません。 無限の柔軟性 ¶ URLは可能な限り柔軟性を持たせています。考えうる URL ... ... case になります。 verbose_name_plural ¶ Options. verbose_name_plural ¶ オブジェクトの名前の複数形: verbose_name_plural = "stories" 指定されない場合、 Django は verbose_name + "s" を使用します。 読み取り専用の Meta 属性 ¶ label ¶ Options. label ¶ オブジ ... 2026年10月08日