... ジェクトのリストから、同じ属性値を持つオブジェクトのグループを作ります。 この複雑なタグは例を通して説明するのがいいでしょう: cities は "name" , "population" , and "country" をキーとして含むディクショナリによって表された都市のリストとします: cities = [ { ... で {% regroup %} タグを使って都市のリストを国別にグループ化できます。以下は、そのためのテンプレートコード例です: {% regroup cities by country as country_list %} < ul > {% for country in country_list %} < li > {{ country.grouper }} < ul > {% for city in ... の引数を取ります。グループ分けを行うリスト、グループ分けに使う属性の名前、そして結果とするリストの名前の 3 つです。ここでは cities リストを country 属性でグループ化し、その結果を country_list と呼んでいます。 {% regroup %} produces a list (in this case, ... ... ジェクトのリストから、同じ属性値を持つオブジェクトのグループを作ります。 この複雑なタグは例を通して説明するのがいいでしょう: cities は "name" , "population" , and "country" をキーとして含むディクショナリによって表された都市のリストとします: cities = [ { ... で {% regroup %} タグを使って都市のリストを国別にグループ化できます。以下は、そのためのテンプレートコード例です: {% regroup cities by country as country_list %} < ul > {% for country in country_list %} < li > {{ country.grouper }} < ul > {% for city in ... の引数を取ります。グループ分けを行うリスト、グループ分けに使う属性の名前、そして結果とするリストの名前の 3 つです。ここでは cities リストを country 属性でグループ化し、その結果を country_list と呼んでいます。 {% regroup %} produces a list (in this case, ... ... for testing. You can download them here: $ wget https://raw.githubusercontent.com/django/django/main/tests/gis_tests/data/cities/cities. { shp,prj,shx,dbf } $ wget https://raw.githubusercontent.com/django/django/main/tests/gis_tests/data/rasters/raste ... 、次のセクションを参照してください: >>> from django.contrib.gis.gdal import DataSource >>> ds = DataSource ( "/path/to/your/cities.shp" ) >>> ds . name '/path/to/your/cities.shp' >>> ds . layer_count # This file only contains one layer 1 layer_count [ソ ... layer in ds : ... print ( 'Layer " %s ": %i %s s' % ( layer . name , len ( layer ), layer . geom_type . name )) ... Layer "cities": 3 Points 上記で読み込まれた都市データソースからの例の出力は、明らかに1つのレイヤーである "cities" を含み、その中に3つのポ ... ... for testing. You can download them here: $ wget https://raw.githubusercontent.com/django/django/main/tests/gis_tests/data/cities/cities. { shp,prj,shx,dbf } $ wget https://raw.githubusercontent.com/django/django/main/tests/gis_tests/data/rasters/raste ... 、次のセクションを参照してください: >>> from django.contrib.gis.gdal import DataSource >>> ds = DataSource ( "/path/to/your/cities.shp" ) >>> ds . name '/path/to/your/cities.shp' >>> ds . layer_count # This file only contains one layer 1 layer_count [ソ ... layer in ds : ... print ( 'Layer " %s ": %i %s s' % ( layer . name , len ( layer ), layer . geom_type . name )) ... Layer "cities": 3 Points 上記で読み込まれた都市データソースからの例の出力は、明らかに1つのレイヤーである "cities" を含み、その中に3つのポ ... ... ContactInfo ( models . Model ): data = models . JSONField () ContactInfo . objects . create ( data = { "name" : "John" , "cities" : [ "London" , "Cambridge" ], "pets" : { "dogs" : [ "Rufus" , "Meg" ]}, } ) ContactInfo . objects . filter ( data__name = ... "John" , data__pets__has_key = "dogs" , data__cities__contains = "London" , ) . delete () If your project uses django.contrib.postgres.fields.JSONField , plus the related form ... ... ContactInfo ( models . Model ): data = models . JSONField () ContactInfo . objects . create ( data = { "name" : "John" , "cities" : [ "London" , "Cambridge" ], "pets" : { "dogs" : [ "Rufus" , "Meg" ]}, } ) ContactInfo . objects . filter ( data__name = ... "John" , data__pets__has_key = "dogs" , data__cities__contains = "London" , ) . delete () If your project uses django.contrib.postgres.fields.JSONField , plus the related form ... ... /#no encoding is done' 注釈 reverse() によって返される文字列は、すでに URL エンコードされています 。例えば: >>> reverse ( "cities" , args = [ "Orléans" ]) '.../Orl%C3%A9ans/' reverse() の出力に対してさらにエンコーディング(例えば urllib.parse.quote() な ... ... /#no encoding is done' 注釈 reverse() によって返される文字列は、すでに URL エンコードされています 。例えば: >>> reverse ( "cities" , args = [ "Orléans" ]) '.../Orl%C3%A9ans/' reverse() の出力に対してさらにエンコーディング(例えば urllib.parse.quote() な ... ... s in this case) are assumed. >>> qs = SouthTexasCity . objects . filter ( point__distance_lte = ( pnt , 7000 )) # Find all Cities within 7 km, > 20 miles away, and > 100 chains away (an obscure unit) >>> qs = SouthTexasCity . objects . filter ( point__ ... ... s in this case) are assumed. >>> qs = SouthTexasCity . objects . filter ( point__distance_lte = ( pnt , 7000 )) # Find all Cities within 7 km, > 20 miles away, and > 100 chains away (an obscure unit) >>> qs = SouthTexasCity . objects . filter ( point__ ... 2026年10月08日