per page, with , order by , clip by
Results of 1 - 10 of about 49 for annotate (0.007 sec.)
アグリゲーション (集計) 14504
アグリゲーション (集計) Djangoのデータベース抽象API のトピックガイドでは、個別のオブジェクトの作成、取得、削除を行うDjangoのクエリの使い方を説明しました。しかし、オブジェクトのコレクションを 集計 (アグリゲーション) した値や、集計することによ ... with a count of books as a "num_books" attribute. >>> from django.db.models import Count >>> pubs = Publisher . objects . annotate ( num_books = Count ( "book" )) >>> pubs <QuerySet [<Publisher: BaloneyPress>, <Publisher: SalamiPress>, ...]> >>> pubs [ ... k__rating__gt = 5 )) >>> below_5 = Count ( "book" , filter = Q ( book__rating__lte = 5 )) >>> pubs = Publisher . objects . annotate ( below_5 = below_5 ) . annotate ( above_5 = above_5 ) >>> pubs [ 0 ] . above_5 23 >>> pubs [ 0 ] . below_5 12 # The top 5 ... publishers, in order by number of books. >>> pubs = Publisher . objects . annotate ( num_books = Count ( "book" )) . order_by ( "-num_books" )[: 5 ] >>> pubs [ 0 ] . num_books 1323 QuerySet に対して集計を生 ...
https://man.mtool.work/django/6.1/topics/db/aggregation.html
データベース関数 13341
データベース関数 The classes documented below provide a way for users to use functions provided by the underlying database as annotations, aggregations, or filters in Django. Functions are also expressions , so they can be used and combined ... functions import Cast >>> Author . objects . create ( age = 25 , name = "Margaret Smith" ) >>> author = Author . objects . annotate ( ... age_as_float = Cast ( "age" , output_field = FloatField ()), ... ) . get () >>> print ( author . age_as_float ) 25.0 ... rt Coalesce >>> Author . objects . create ( name = "Margaret Smith" , goes_by = "Maggie" ) >>> author = Author . objects . annotate ( screen_name = Coalesce ( "alias" , "goes_by" , "name" )) . get () >>> print ( author . screen_name ) Maggie >>> # Preven ... >> comment = Comment . objects . create ( body = "No, Least is better." , blog = blog ) >>> comments = Comment . objects . annotate ( last_updated = Greatest ( "modified" , "blog__modified" )) >>> annotated_comment = comments . get () annotated_comment.l ...
https://man.mtool.work/django/6.1/ref/models/database-functions.html
全文検索 10383
全文検索 django.contrib.postgres.search モジュールのデータベース関数は PostgreSQL の 全文検索エンジン を利用しやすくしています。 このドキュメントの例では、 クエリを作成する で定義されたモデルを使用します。 参考 検索の概要については、 トピッ ... リを行うには、 SearchVector を使用します: >>> from django.contrib.postgres.search import SearchVector >>> Entry . objects . annotate ( ... search = SearchVector ( "body_text" , "blog__tagline" ), ... ) . filter ( search = "Cheese" ) <QuerySet [<Entry: Che ... 検索ドキュメントにすべて含まれます。 SearchVector オブジェクトは組み合わせて再利用できます。たとえば: >>> Entry . objects . annotate ( ... search = SearchVector ( "body_text" ) + SearchVector ( "blog__tagline" ), ... ) . filter ( search = "Cheese" ) <Quer ... chRank , SearchVector >>> vector = SearchVector ( "body_text" ) >>> query = SearchQuery ( "cheese" ) >>> Entry . objects . annotate ( rank = SearchRank ( vector , query )) . order_by ( "-rank" ) <QuerySet [<Entry: Cheese on Toast recipes>, <Entry: Pizza ...
https://man.mtool.work/django/6.1/ref/contrib/postgres/search.html
クエリ式 (Query Expression) 9704
クエリ式 (Query Expression) クエリ式 (query expression) は、update、create、filter、order by、annotation、またはaggregateの一部として使用できる値または計算を記述します。式が真偽値を出力する場合、フィルタで直接使用できます。クエリの記述に使用 ... pany to seat all employees? >>> company = ( ... Company . objects . filter ( num_employees__gt = F ( "num_chairs" )) ... . annotate ( chairs_needed = F ( "num_employees" ) - F ( "num_chairs" )) ... . first () ... ) >>> company . num_employees 120 >>> com ... company = Company . objects . create ( name = "Google" , ticker = Upper ( Value ( "goog" ))) >>> company . ticker 'GOOG' # Annotate models with an aggregated value. Both forms # below are equivalent. >>> Company . objects . annotate ( num_products = Coun ... t ( "products" )) >>> Company . objects . annotate ( num_products = Count ( F ( "products" ))) # Aggregates can contain complex computations also >>> Company . objects . ann ...
https://man.mtool.work/django/6.1/ref/models/expressions.html
Django 2.2.28 リリースノート 8285
Django 2.2.28 リリースノート 2022年4月11日 Django 2.2.28 では 2.2.27 における深刻度 "high" のセキュリティの問題2件を修正しました。 CVE-2022-28346: Potential SQL injection in QuerySet.annotate() , aggregate() , and extra() QuerySet.annotate( ...
https://man.mtool.work/django/6.1/releases/2.2.28.html
Django 3.2.13 リリースノート 8165
Django 3.2.13 リリースノート 2022年4月11日 Django 3.2.13 では 3.2.12 における深刻度 "high" のセキュリティの問題2件と 3.2.4 におけるリグレッションを修正しました。 CVE-2022-28346: Potential SQL injection in QuerySet.annotate() , aggregate() , ... and extra() QuerySet.annotate() , aggregate() , and extra() methods were subject to SQL injection in column aliases, using a suitably crafted dictionary ...
https://man.mtool.work/django/6.1/releases/3.2.13.html
Django 4.0.4 リリースノート 8104
Django 4.0.4 リリースノート 2022年4月11日 Django 4.0.4 では 4.0.3 における深刻度 "high" のセキュリティの問題2件とバグ2件を修正しました。 CVE-2022-28346: Potential SQL injection in QuerySet.annotate() , aggregate() , and extra() QuerySet.annotate ...
https://man.mtool.work/django/6.1/releases/4.0.4.html
地理情報データベース関数 7984
地理情報データベース関数 このページで説明する関数を使えば、Django のアノテーションや集約、フィルタで使う地理情報データベース関数にアクセスできます。 例: >>> from django.contrib.gis.db.models.functions import Length >>> Track . objects . annotate ... ort Distance >>> pnt = AustraliaCity . objects . get ( name = "Hobart" ) . point >>> for city in AustraliaCity . objects . annotate ( distance = Distance ( "point" , pnt )): ... print ( city . name , city . distance ) ... Wollongong 990071.220408 m Shell ... 構造体のキーコンテンツ geometry だけであることに注意してください。 GeoJSON シリアライザ も参照。 例: >>> City . objects . annotate ( json = AsGeoJSON ( "point" )) . get ( name = "Chicago" ) . json {"type":"Point","coordinates":[-87.65018,41.85039]} キー ... ルドまたは式を受け取り、そのジオメトリの Geographic Markup Language (GML) 表現を返します。 例: >>> qs = Zipcode . objects . annotate ( gml = AsGML ( "poly" )) >>> print ( qs [ 0 ] . gml ) <gml:Polygon srsName="EPSG:4326"><gml:OuterBoundaryIs>-147.78711,70 ...
https://man.mtool.work/django/6.1/ref/contrib/gis/functions.html
QuerySet API リファレンス 7923
QuerySet API リファレンス このドキュメントでは、 QuerySet API の詳細を説明しています。 モデル と データベースクエリ ガイドにある説明を前提としていますので、このドキュメントを読む前にこの 2 つを読んでおくことをおすすめします。 このリファレン ... ogic When passing a QuerySet to the in lookup, ensure the subquery does not return NULL values. See this note for details. annotate() annotate ( * args , ** kwargs ) Annotates each object in the QuerySet with the provided list of query expressions or Q() ... オブジェクト . Each object can be annotated with: Value() で指定する単純な値。 F() で指定するモデル(または関連モデル)のフィールドへの参照。 Q() で指定する真偽値(判 ... 定式)。 QuerySet 内のオブジェクトに関連付けられたオブジェクトに対して計算された集約式(平均、合計など)の結果。 annotate() に渡される引数はそれぞれがアノテーションとなって、返される QuerySet 内の各オブジェクトに追加されます。 Djangoが提供する集 ...
https://man.mtool.work/django/6.1/ref/models/querysets.html
Django 4.2.25 リリースノート 7863
Django 4.2.25 リリースノート 2025年10月1日 Django 4.2.25 では 4.2.24 におけるセキュリティの問題のうち 深刻度 "high" 1件と深刻度 "low" 1件を修正しました。 CVE-2025-59681: MySQL および MariaDB における QuerySet.annotate() , alias() , aggregat ... e() , および extra() 利用時の SQL インジェクションの可能性 QuerySet.annotate() , alias() , aggregate() , および extra() メソッドには、列エイリアスにおける SQL インジェクションの脆弱性が存在していまし ...
https://man.mtool.work/django/6.1/releases/4.2.25.html
PREV 1 2 3 4 5 NEXT