... ルの現在の値を参照したいこともあるでしょう。これを行うには、 {% cycle %} タグに名前を付けます: {% cycle 'row1' 'row2' as rowcolors %} これ以降、コンテキスト変数としてサイクル名を参照することで、テンプレート内のどの場所にも現在のサイクルの値を挿入できま ... を指定して別の cycle タグを使用します。以下にテンプレートの例を挙げます: < tr > < td class = " {% cycle 'row1' 'row2' as rowcolors %} " > ... </ td > < td class = " {{ rowcolors }} " > ... </ td > </ tr > < tr > < td class = " {% cycle rowcolors %} " > ... ... </ td > < td class = " {{ rowcolors }} " > ... </ td > </ tr > これは以下のように出力されます: < tr > < td class = "row1" > ... </ td > < td class = "row1" > ... ... ベースクラスとなっているので、以下に挙げるような基本的なディクショナリのメソッドを持っています。 __getitem__ ( key ) 例: fav_color = request.session['fav_color'] __setitem__ ( key , value ) 例: request.session['fav_color'] = 'blue' __delitem__ ( key ) 例 ... : del request.session['fav_color'] 与えられた key がセッション内にない場合には、 KeyError 例外を起こします。 __contains__ ( key ) 例: 'fav_color' in reques ... ession has data or a key pass get ( key , default = None ) aget ( key , default = None ) 非同期バージョン : aget() 例: fav_color = request.session.get('fav_color', 'red') aset ( key , value ) 例: await request.session.aset('fav_color', 'red') update ( ... ... uits" , "page" : 2 }, fragment = "results" ) '/admin/?q=biscuits&page=2#results' >>> reverse ( "admin:index" , query = [( "color" , "blue" ), ( "color" , 1 ), ( "none" , None )]) '/admin/?color=blue&color=1&none=None' >>> reverse ( "admin:index" , que ... ... ted by QuerySet.bulk_create() on PostgreSQL ( #33647 ). Fixed a bug where management command colorized help (introduced in Python 3.14) ignored the --no-color option and the DJANGO_COLORS setting ( #36376 ). ... ... the name of a ManyToManyField from taking effect when applying migrations ( #36800 ). Fixed a bug where management command colorized help (introduced in Python 3.14) ignored the --no-color option and the DJANGO_COLORS setting ( #36376 ). Fixed a regre ... ... ( models . Model ): first_name = models . CharField ( max_length = 50 ) last_name = models . CharField ( max_length = 50 ) color_code = models . CharField ( max_length = 6 ) @admin . display def colored_name ( self ): return format_html ( '<span style ... ="color: # {} ;"> {} {} </span>' , self . color_code , self . first_name , self . last_name , ) class PersonAdmin ( admin . ModelA ... dmin ): list_display = [ "first_name" , "last_name" , "colored_name" ] これまでの例で見てきたように、呼び出し可能オブジェクト、モデルメソッド、または ModelAdmin メソッドを使用する場合 ... ... jango.db import models class Fruit ( models . Model ): name = models . CharField ( max_length = 100 , primary_key = True ) color = models . CharField ( max_length = 100 ) >>> fruit = Fruit . objects . create ( name = "Apple" , color = "Green" ) >>> fr ... uit . name = "Pear" >>> fruit . save () >>> Fruit . objects . order_by ( "name" ) . values_list ( "name" , "color" ) <QuerySet [('Apple', 'Green'), ('Pear', 'Green')]> >>> # Saving with an existing primary key updates that row. >>> pear ... = Fruit . objects . get ( name = "Pear" ) >>> pear . name = "Apple" >>> pear . color = "Red" >>> pear . save () >>> Fruit . objects . order_by ( "name" ) . values_list ( "name" , "color" ) <QuerySet [('Apple ... ... g is acceptable for content like images, maps, videos, and data tables, which require both dimensions to be usable. Forced-colors mode (for example Windows Contrast Themes). Note that this can be tested via the "high_contrast" mode in the screenshot t ... ests . Common issues include: Over-reliance on color for meaning, which is lost in forced-colors mode. Use of !important or inline styles may break forced-colors mode. Recomme ... ... t に対して years 属性がセットされます: from django import forms BIRTH_YEAR_CHOICES = [ "1980" , "1981" , "1982" ] FAVORITE_COLORS_CHOICES = { "blue" : "Blue" , "green" : "Green" , "black" : "Black" , } class SimpleForm ( forms . Form ): birth_year = f ... orms . DateField ( widget = forms . SelectDateWidget ( years = BIRTH_YEAR_CHOICES ) ) favorite_colors = forms . MultipleChoiceField ( required = False , widget = forms . CheckboxSelectMultiple , choices = FAVORITE_COLORS_CH ... Input [ソース] input_type : 'url' template_name : 'django/forms/widgets/url.html' レンダリング結果: <input type="url" ...> ColorInput class ColorInput [ソース] input_type : 'color' template_name : 'django/forms/widgets/color.html' レンダリング結果: <i ... ... 常に 詳細な出力を意味します。 このオプションは runserver では無視されます。 使用例: django-admin migrate --verbosity 2 --no-color Disables colorized command output. Some commands format their output to be colorized. For example, errors will be printed ... to the console in red and SQL statements will be syntax highlighted. 使用例: django-admin runserver --no-color --force-color シンタックスカラーリング で説明されているように、コマンドの出力が無効になる場合でも出力のカラー表示を強制しま ... やタプルでない場合にだけ有効です。 使用例: django-admin migrate --skip-checks 追加の便利機能 シンタックスカラーリング DJANGO_COLORS django-admin / manage.py コマンドは、ターミナルが ANSI カラー出力をサポートしている場合、色分けされた出力を使用します。 - ... 2026年10月08日