per page, with , order by , clip by
Results of 1 - 10 of about 128 for Order (0.007 sec.)
複合主キー 11854
複合主キー Django では、すべてのモデルに主キーが存在します。デフォルトでは、この主キーは単一のフィールドで構成されます。 ほとんどの場合、単一の主キーで十分です。しかし、データベース設計においては、複数のフィールドからなる主キーが必要になるこ ... を CompositePrimaryKey に設定します: class Product ( models . Model ): name = models . CharField ( max_length = 100 ) class Order ( models . Model ): reference = models . CharField ( max_length = 20 , primary_key = True ) class OrderLineItem ( models . ... Model ): pk = models . CompositePrimaryKey ( "product_id" , "order_id" ) product = models . ForeignKey ( Product , on_delete = models . CASCADE ) order = models . ForeignKey ( Order , on_de ... . CASCADE ) quantity = models . IntegerField () これにより、Django はテーブル作成時に複合主キー( PRIMARY KEY (product_id, order_id) )を作成するようになります。 複合主キーは tuple (タプル)で表現されます: >>> product = Product . objects . create ( n ...
https://man.mtool.work/django/6.1/topics/composite-primary-key.html
モデルの Meta オプション 11256
モデルの Meta オプション このドキュメントでは、モデル内部の class Meta 内でモデルに与えられる、すべての可能な メタデータオプション を説明します。 利用可能な Meta オプション abstract Options. abstract abstract = True の場合、このモデルは 抽象 ... デル Manager の latest() と earliest() メソッドで使用するデフォルトのフィールドを指定します。 実装例: # Latest by ascending order_date. get_latest_by = "order_date" # Latest by priority descending, order_date ascending. get_latest_by = [ "-priority" , ... "order_date" ] 詳しくは latest() のドキュメントを参照してください。 managed Options. managed デフォルトは True です。つまり、 Dja ... e を使って既存のモデルのコピーを作成することもできます。しかし、その場合はもっと良い方法があります。 プロキシモデル です。 order_with_respect_to Options. order_with_respect_to このオブジェクトを指定されたフィールドに対してソート可能にします。通常は Fo ...
https://man.mtool.work/django/6.1/ref/models/options.html
QuerySet API リファレンス 11256
QuerySet API リファレンス このドキュメントでは、 QuerySet API の詳細を説明しています。 モデル と データベースクエリ ガイドにある説明を前提としていますので、このドキュメントを読む前にこの 2 つを読んでおくことをおすすめします。 このリファレン ... のセクションで後ほど詳しく説明します。 QuerySet クラスは、イントロスペクションのために以下のパブリックな属性を持っています: ordered [ソース] True if the QuerySet is ordered — i.e. has an order_by() clause or a default ordering on the model. False other ... wise. totally_ordered [ソース] New in Django 6.1. Returns True if the QuerySet is ordered and the ordering is deterministic. This requires tha ... t the ordering includes a field (or set of fields) that is unique and non-nullable. For queries involving a GROUP BY clause, the model ...
https://man.mtool.work/django/6.1/ref/models/querysets.html
フォームセット (Formset) 10365
フォームセット (Formset) class BaseFormSet [ソース] フォームセットは、同じページで複数のフォームを扱うための抽象レイヤーです。データグリッドに例えるとわかりやすいでしょう。次のようなフォームがあるとしましょう: >>> from django import forms > ... ArticleFormSet = formset_factory ( ArticleForm , extra = 2 ) Formsets can be iterated and indexed, accessing forms in the order they were created. You can reorder the forms by overriding the default __iter__() and __getitem__() methods if needed. (Fo ... には、フォームセット内のフォームの順序およびフォームセットからのフォームの削除に役立つ 2 つのオプション引数があります。 can_order BaseFormSet. can_order デフォルト値: False 下記のように、ソート可能なフォームセットを作成できます: >>> from django.forms i ... mport formset_factory >>> from myapp.forms import ArticleForm >>> ArticleFormSet = formset_factory ( ArticleForm , can_order = True ) >>> formset = ArticleFormSet ( ... initial = [ ... { "title" : "Article #1" , "pub_date" : datetime . date ( 2008 ...
https://man.mtool.work/django/6.1/topics/forms/formsets.html
配信 (syndication) フィード フレームワーク 9925
配信 (syndication) フィード フレームワーク Django には、 RSS と Atom フィードを作成するための高レベルな配信 (syndication) フィード生成フレームワークが付属しています。 任意の配信フィードを作成するには、短い Python クラスを書くだけで済みます。 ... " description = "Updates on changes and additions to police beat central." def items ( self ): return NewsItem . objects . order_by ( "-pub_date" )[: 5 ] def item_title ( self , item ): return item . title def item_description ( self , item ): return ... Feed ): title = "My articles" description_template = "feeds/articles.html" def items ( self ): return Article . objects . order_by ( "-pub_date" )[: 5 ] def get_context_data ( self , ** kwargs ): context = super () . get_context_data ( ** kwargs ) co ... ently reported in police beat %s " % obj . beat def items ( self , obj ): return Crime . objects . filter ( beat = obj ) . order_by ( "-crime_date" )[: 30 ] フィードの <title> , <link> , <description> を生成するために、 Django は title() , link() , de ...
https://man.mtool.work/django/6.1/ref/contrib/syndication.html
クエリ式 (Query Expression) 9181
クエリ式 (Query Expression) クエリ式 (query expression) は、update、create、filter、order by、annotation、またはaggregateの一部として使用できる値または計算を記述します。式が真偽値を出力する場合、フィルタで直接使用できます。クエリの記述に使用 ... any . objects . annotate ( num_offerings = Count ( F ( "products" ) + F ( "services" ))) # Expressions can also be used in order_by(), either directly >>> Company . objects . order_by ( Length ( "name" ) . asc ()) >>> Company . objects . order_by ( Le ... Field >>> from django.db.models.functions import Length >>> CharField . register_lookup ( Length ) >>> Company . objects . order_by ( "name__length" ) # Boolean expression can be used directly in filters. >>> from django.db.models import Exists , Oute ... contacted がNULL) をコンタクトした企業の後に並べるには次のようにします: from django.db.models import F Company . objects . order_by ( F ( "last_contacted" ) . desc ( nulls_last = True )) 論理演算で F() を使う BooleanField を出力する F() 式は反転演算子 ...
https://man.mtool.work/django/6.1/ref/models/expressions.html
PostgreSQL 固有の集計関数 9034
PostgreSQL 固有の集計関数 これらの機能は、 django.contrib.postgres.aggregates モジュールから利用可能です。これらについての詳細は、 PostgreSQLドキュメント に記載されています。 注釈 すべての関数はデフォルトのエイリアスを持たないので、明示的に ... も持っています。 汎用的な集計関数 ArrayAgg class ArrayAgg ( expression , distinct = False , filter = None , default = None , order_by = () , ** extra ) null を含む値のリストを配列に連結して返すか、値がない場合は default を返す。 distinct オプションの真偽 ... 値引数で、配列の値を区別するかどうかを指定する。デフォルトは False です。 order_by 結果リスト内の要素の並び順を指定する、省略可能なフィールド名の文字列 (降順を示すオプションの ""-"" 接頭辞を含む) または ... 式 (もしくは文字列および/または式のタプルもしくはリスト)。 例: from django.db.models import F ArrayAgg ( "a_field" , order_by = "-some_field" ) ArrayAgg ( "a_field" , order_by = F ( "some_field" ) . desc ()) BitAnd class BitAnd ( expression , fi ...
https://man.mtool.work/django/6.1/ref/contrib/postgres/aggregates.html
Django 1.5 リリースノート 7911
Django 1.5 リリースノート February 26, 2013 Django 1.5 へようこそ! These release notes cover the new features , as well as some backwards incompatible changes you'll want to be aware of when upgrading from Django 1.4 or older versions. We'v ... both situations when those templates are not found. It's still recommended as good practice to provide those templates in order to present pretty error pages to the user. django.contrib.auth provides a new signal that is emitted whenever a user fails ... s allow you to test equality for XML content at a semantic level, without caring for syntax differences (spaces, attribute order, etc.). RemoteUserMiddleware now forces logout when the REMOTE_USER header disappears during the same browser session. The ... archive class-based views YearArchiveView and MonthArchiveView were documented to provide a date_list sorted in ascending order in the context, like their function-based predecessors, but it actually was in descending order. In 1.5, the documented or ...
https://man.mtool.work/django/6.1/releases/1.5.html
アグリゲーション (集計) 7398
アグリゲーション (集計) Djangoのデータベース抽象API のトピックガイドでは、個別のオブジェクトの作成、取得、削除を行うDjangoのクエリの使い方を説明しました。しかし、オブジェクトのコレクションを 集計 (アグリゲーション) した値や、集計することによ ... ow_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" )[ ... ん 。 annotate() 句のアウトプットは QuerySet です。この QuerySet は、他の QuerySet の操作によって修正可能です。 filter() 、 order_by() などに加えて、別の annotate() を追加呼び出しすることもできます。 複数のアグリゲーションを統合する annotate() を用いて ... 方法を直感的に理解するのは難しいので、疑問がある場合は str(QuerySet.query) でSQLを検査し、たくさんのテストを書いてください。 order_by() アノテーションは、ソートの基準として使うことができます。 order_by() 句を定義すると、クエリの annotate() 句の中で定義さ ...
https://man.mtool.work/django/6.1/topics/db/aggregation.html
Django 3.1.13 リリースノート 7325
Django 3.1.13 リリースノート July 1, 2021 Django 3.1.13 fixes a security issue with severity "high" in 3.1.12. CVE-2021-35042: Potential SQL injection via unsanitized QuerySet.order_by() input Unsanitized user input passed to QuerySet.order ...
https://man.mtool.work/django/6.1/releases/3.1.13.html
PREV 1 2 3 4 5 6 7 8 9 10 NEXT