per page, with , order by , clip by
Results of 1 - 10 of about 52 for count (0.010 sec.)
アグリゲーション (集計) 15726
アグリゲーション (集計) Djangoのデータベース抽象API のトピックガイドでは、個別のオブジェクトの作成、取得、削除を行うDjangoのクエリの使い方を説明しました。しかし、オブジェクトのコレクションを 集計 (アグリゲーション) した値や、集計することによ ... 急ぎですか? 上のモデルを使った場合の一般的な集計クエリは以下のようになります: # Total number of books. >>> Book . objects . count () 2452 # Total number of books with publisher=BaloneyPress >>> Book . objects . filter ( publisher__name = "BaloneyPress" ... ) . count () 73 # Average price across all books, provide default to be returned instead # of None if no books exist. >>> from djang ... lowing queries involve traversing the Book<->Publisher # foreign key relationship backwards. # Each publisher, each with a count of books as a "num_books" attribute. >>> from django.db.models import Count >>> pubs = Publisher . objects . annotate ( nu ...
https://man.mtool.work/django/6.1/topics/db/aggregation.html
翻訳 10798
翻訳 概要 Django プロジェクトを翻訳可能にするためには、Python コードやテンプレートに、多少のフックを加筆しなければなりません。このフックは 翻訳文字列 と呼ばれます。翻訳文字列は Django に「このテキストに対する翻訳が有効な場合、このテキストは ... の関数は、Django アプリケーションを数と 複数形 の複雑さが英語で 2 より大きい (その値にかかわらず、単数には 'object'、そして count が 1 ではない全ての場合に 'objects' となります。) 言語にローカライズさせる必要がある場合に役立ちます。 例: from django.htt ... p import HttpResponse from django.utils.translation import ngettext def hello_world ( request , count ): page = ngettext ( "there is %(count)d object" , "there are %(count)d objects" , count , ) % { "count" : count , } retur ... n HttpResponse ( page ) この例では、オブジェクトの数値は count 変数として翻訳言語に渡されます。 複数形は、複雑で言語によって異なる動作をすることに注意してください。 count と 1 の比較は正 ...
https://man.mtool.work/django/6.1/topics/i18n/translation.html
条件式 10185
条件式 Conditional expressions let you use if ... elif ... else logic within filters, annotations, aggregations, and updates. A conditional expression evaluates a series of conditions for each row of a table and returns the matching result ... モデルを使用します: from django.db import models class Client ( models . Model ): REGULAR = "R" GOLD = "G" PLATINUM = "P" ACCOUNT_TYPE_CHOICES = { REGULAR : "Regular" , GOLD : "Gold" , PLATINUM : "Platinum" , } name = models . CharField ( max_length = ... 50 ) registered_on = models . DateField () account_type = models . CharField ( max_length = 1 , choices = ACCOUNT_TYPE_CHOICES , default = REGULAR , ) When class When ( cond ... models import F , Q , When >>> # String arguments refer to fields; the following two examples are equivalent: >>> When ( account_type = Client . GOLD , then = "name" ) >>> When ( account_type = Client . GOLD , then = F ( "name" )) >>> # You can use fi ...
https://man.mtool.work/django/6.1/ref/models/conditional-expressions.html
QuerySet API リファレンス 9887
QuerySet API リファレンス このドキュメントでは、 QuerySet API の詳細を説明しています。 モデル と データベースクエリ ガイドにある説明を前提としていますので、このドキュメントを読む前にこの 2 つを読んでおくことをおすすめします。 このリファレン ... を返します。 メモ: セット内のレコード数を決定したいだけであれば(そして実際のオブジェクトが必要ないのであれば)、SQLの SELECT COUNT(*) を使ってデータベースレベルでハンドルする方がより効率的です。Djangoはまさにこの理由から count() メソッドを提供しています ... たとえば、ブログのリストを操作しているときに、ブログごとのエントリー数を決定したいとします: >>> from django.db.models import Count >>> q = Blog . objects . annotate ( Count ( "entry" )) # The name of the first blog >>> q [ 0 ] . name 'Blogasaurus' # The ... number of entries on the first blog >>> q [ 0 ] . entry__count 42 Blog モデル自体は entry__count 属性を定義しませんが、集計式を指定したキーワード引数を用いることで、集計情報の名前を制御 ...
https://man.mtool.work/django/6.1/ref/models/querysets.html
Django 1.8.5 リリースノート 8901
Django 1.8.5 リリースノート October 3, 2015 Django 1.8.5 fixes several bugs in 1.8.4. バグ修正 Made the development server's autoreload more robust ( #24704 ). Fixed AssertionError in some delete queries with a model containing a field that ... 25384 ). Fixed migrations crash on MySQL when adding a text or a blob field with an unhashable default ( #25393 ). Changed Count queries to execute COUNT(*) instead of COUNT('*') as versions of Django before 1.8 did ( #25377 ). This may fix a performa ...
https://man.mtool.work/django/6.1/releases/1.8.5.html
ページ分割 (Pagination) 8826
ページ分割 (Pagination) Django は、ページ分割 (ページネーション) されたデータを管理するための高レベルと低レベルの方法を提供しています。つまり、"前へ/次へ" リンクを持つ、複数のページに分割されたデータです。 Paginator クラス 内部では、ページ分 ... aginator import Paginator >>> objects = [ "john" , "paul" , "george" , "ringo" ] >>> p = Paginator ( objects , 2 ) >>> p . count 4 >>> p . num_pages 2 >>> type ( p . page_range ) <class 'range'> >>> p . page_range range(1, 3) >>> page1 = p . page ( 1 ... cent call last): ... EmptyPage : That page contains no results 注釈 Paginator には、リストやタプル、 Django の QuerySet 、 count() または __len__() メソッドを持つどんなオブジェクトでも与えることができます。渡されたオブジェクトに含まれるオブジェクト数を ... 特定するとき、 Paginator は最初に count() メソッドの実行を試み、その後、渡されたオブジェクトが count() メソッドを実装していなかった場合のフォールバックとして len( ...
https://man.mtool.work/django/6.1/topics/pagination.html
データベース関数 8289
データベース関数 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 ... r in which they started? >>> Experiment . objects . filter ( start_datetime__year = Extract ( "end_datetime" , "year" )) . count () 1 Extract() uses the active timezone When USE_TZ is True , Django saves values in UTC (or the connection's configured t ... ) ... ) . filter ( extract_hour_start = start . hour ) # Comparing local time to UTC finds no results. >>> find_this_exp . count () 0 >>> find_this_exp_adjusted = Experiment . objects . annotate ( ... extract_hour_start = ExtractHour ( "start_datetime ... " , tzinfo = UTC ) ... ) . filter ( extract_hour_start = start . hour ) >>> find_this_exp_adjusted . count () 1 DateField からの抽出 (extract) class ExtractYear ( expression , tzinfo = None , ** extra ) [ソース] lookup_name = 'ye ...
https://man.mtool.work/django/6.1/ref/models/database-functions.html
ページ分割 (Paginator) 8289
ページ分割 (Paginator) Django はページ分割されたデータを管理するのに役立ついくつかのクラスを提供しています。これらのクラスは django/core/paginator.py にあります。 例については ページ分割 (Pagination) のトピックガイド を参照してください。 Pa ... テレートしたときは Page のシーケンスのように動作します。 Paginator. object_list 必須です。リスト、タプル、 QuerySet 、または count() または __len__() メソッドを持つその他のスライス可能なオブジェクト。一貫したページ分割のためには、 QuerySet は順序付けされ ... によって返されるページ範囲において、ページ番号の代わりに使用される翻訳可能な文字列です。デフォルトは '…' です。 Paginator. count [ソース] 全ページにわたるオブジェクトの総数。 注釈 オブジェクトリスト object_list に含まれるオブジェクトの数を決定する場合 ... 、 Paginator はまず object_list.count() を呼び出します。もし object_list に count() メソッドがなければ、 Paginator は len(object_list) を使用します。これにより、 ...
https://man.mtool.work/django/6.1/ref/paginator.html
クエリ式 (Query Expression) 7841
クエリ式 (Query Expression) クエリ式 (query expression) は、update、create、filter、order by、annotation、またはaggregateの一部として使用できる値または計算を記述します。式が真偽値を出力する場合、フィルタで直接使用できます。クエリの記述に使用 ... 果を得やすくなります。詳しくは カスタムのモデルフィールドを作成する を参照してください。 例 >>> from django.db.models import Count , F , Value >>> from django.db.models.functions import Length , Upper >>> from django.db.models.lookups import GreaterThan ... tate models with an aggregated value. Both forms # below are equivalent. >>> Company . objects . annotate ( num_products = Count ( "products" )) >>> Company . objects . annotate ( num_products = Count ( F ( "products" ))) # Aggregates can contain comp ... lex computations also >>> Company . objects . annotate ( num_offerings = Count ( F ( "products" ) + F ( "services" ))) # Expressions can also be used in order_by(), either directly >>> Company . object ...
https://man.mtool.work/django/6.1/ref/models/expressions.html
Django 1.6.1 リリースノート 7841
Django 1.6.1 リリースノート December 12, 2013 This is Django 1.6.1, a bugfix release for Django 1.6. In addition to the bug fixes listed below, translations submitted since the 1.6 release are also included. Bug fixes Fixed BCryptSHA256Pass ... a crash when a GeometryField uses a non-geometric widget (#21496). Fixed password hash upgrade when changing the iteration count (#21535). Fixed a bug in the debug view when the URLconf only contains one element (#21530). Re-added missing search resul ... t count and reset link in changelist admin view (#21510). The current language is no longer saved to the session by LocaleMiddlewa ...
https://man.mtool.work/django/6.1/releases/1.6.1.html
PREV 1 2 3 4 5 6 NEXT