per page, with , order by , clip by
Results of 1 - 10 of about 74 for ForeignKey (0.011 sec.)
モデルフィールドリファレンス 15159
モデルフィールドリファレンス このドキュメントには、Django が提供するフィールドオプション field options とフィールド型 field types を含む、 Field のすべての API リファレンスが記載されています。 注釈 フィールドは django.db.models.fields に定義 ... ーケンスオブジェクトでも構いません。これにより、選択肢を動的に構築できます。しかし、 choices をハックして動的にするよりは、 ForeignKey を持つ適切なデータベーステーブルを使ったほうがいいでしょう。 choices はあまり変更されない静的なデータのためのものです。 注 ... できないので、 default のようなフィールドオプションには使えません。その他の注意点についてはドキュメントを参照してください。 ForeignKey のようにモデルインスタンスにマッピングされるフィールドの場合、デフォルトはモデルインスタンスではなく、参照するフィールドの ... phenated uuid datatype type. リレーションシップフィールド Djangoは、リレーションを表すフィールドのセットも定義しています。 ForeignKey class ForeignKey ( to , on_delete , ** options ) [ソース] 多対一のリレーションシップです。モデルが関連するクラスと、 on_de ...
https://man.mtool.work/django/6.1/ref/models/fields.html
Django の admin サイト 10129
Django の admin サイト Django のパワフルな特徴の1つは、自動的に生成される admin インタフェースです。あなたのモデルクラスからメタデータを読み取り、モデル中心のインタフェースを提供します。このインタフェースのおかげで、ユーザはあなたのサイトの ... ムフィールドの __init__() メソッドに渡されます。詳細は フォーム API を参照してください。 警告 リレーションフィールド (例えば ForeignKey や ManyToManyField ) でカスタムウィジェットを使用したいときは、, raw_id_fields 、 radio_fields 、 autocomplete_fields にそ ... odelAdmin ): list_display = [ "name" , "decade_born_in" ] list_display に関する特殊な状況の注意点があります。 フィールドが ForeignKey の場合、 Django はリレーション先オブジェクトの __str__() を表示します。 ManyToManyField フィールドは、テーブル内で各行に対 ... ートできるようにしています: class Blog ( models . Model ): title = models . CharField ( max_length = 255 ) author = models . ForeignKey ( Person , on_delete = models . CASCADE ) class BlogAdmin ( admin . ModelAdmin ): list_display = [ "title" , "author" , "a ...
https://man.mtool.work/django/6.1/ref/contrib/admin/
リレーション先オブジェクトのリファレンス 9906
リレーション先オブジェクトのリファレンス class RelatedManager "関係マネージャ(related manager)"とは、1対多または多対多の関係するコンテキストで使用されるマネージャのことです。これは2つのケースで起こります: ForeignKey リレーションの "反対側 ... まり: from django.db import models class Blog ( models . Model ): # ... pass class Entry ( models . Model ): blog = models . ForeignKey ( Blog , on_delete = models . CASCADE , null = True ) 上記の例では、以下のメソッドがマネージャ blog.entry_set で利用可能で ... ) >>> e = Entry . objects . get ( id = 234 ) >>> b . entry_set . add ( e ) # Associates Entry e with Blog b. 上の例では、 ForeignKey リレーションの場合、 QuerySet.update() を使って更新を行います。これにはオブジェクトが既に保存されている必要があります。 引 ... のリレーションシップの場合、 remove() は *objs 引数としてモデルインスタンスかフィールドの値(通常は主キー)を受け付けます。 ForeignKey オブジェクトでは、このメソッドは null=True の場合のみ存在します。リレーション先フィールドを None ( NULL ) に設定できない場 ...
https://man.mtool.work/django/6.1/ref/models/relations.html
複合主キー 9669
複合主キー Django では、すべてのモデルに主キーが存在します。デフォルトでは、この主キーは単一のフィールドで構成されます。 ほとんどの場合、単一の主キーで十分です。しかし、データベース設計においては、複数のフィールドからなる主キーが必要になるこ ... class OrderLineItem ( models . Model ): pk = models . CompositePrimaryKey ( "product_id" , "order_id" ) product = models . ForeignKey ( Product , on_delete = models . CASCADE ) order = models . ForeignKey ( Order , on_delete = models . CASCADE ) quantity = ... グできます: >>> OrderLineItem . objects . filter ( pk = ( 1 , "A755H" )) . count () 1 リレーションシップフィールド ( GenericForeignKey を含む) や Django 管理サイトにおける複合主キーのサポートは、現在も開発中です。現時点では、複合主キーを持つモデルは Django ... ほどの OrderLineItem モデルにおいて、次のような使い方はサポートされていません: class Foo ( models . Model ): item = models . ForeignKey ( OrderLineItem , on_delete = models . CASCADE ) これは、現在 ForeignKey が複合主キーを持つモデルを参照できないためです。 ...
https://man.mtool.work/django/6.1/topics/composite-primary-key.html
モデル 9558
モデル モデルは、データに関する唯一かつ決定的な情報源です。あなたが保持するデータが必要とするフィールドとその動作を定義します。一般的に、各モデルは単一のデータベースのテーブルに対応付けられます。 基本: モデルは各々 Python のクラスであり dja ... ( max_length = 50 ) instrument = models . CharField ( max_length = 100 ) class Album ( models . Model ): artist = models . ForeignKey ( Musician , on_delete = models . CASCADE ) name = models . CharField ( max_length = 100 ) release_date = models . DateFie ... ず 1 つだけ (明示的に宣言されるか、自動的に追加されるかのどちらかで) 存在する必要があります。 詳細 (verbose) なフィールド名 ForeignKey 、 ManyToManyField 、 OneToOneField を除くすべてのフィールド型は、任意の第 1 引数として "詳細な名前 (verbose name)" を取り ... ame" , max_length = 30 ) 以下の例では、詳細な名前は "first name" です: first_name = models . CharField ( max_length = 30 ) ForeignKey 、 ManyToManyField 、 OneToOneField の 3 つは最初の引数にモデルクラスを必要とするので、 verbose_name キーワード引数を使用し ...
https://man.mtool.work/django/6.1/topics/db/models.html
Django 1.8.2 リリースノート 9084
Django 1.8.2 リリースノート May 20, 2015 Django 1.8.2 fixes a security issue and several bugs in 1.8.1. Fixed session flushing in the cached_db backend A change to session.flush() in the cached_db session backend in Django 1.8 mistakenly se ... d in a crash ( #24705 ). Fixed incorrect GROUP BY clause generation on MySQL when the query's model has a self-referential foreign key ( #24748 ). Implemented ForeignKey.get_db_prep_value() so that ForeignKey s pointing to UUIDField and inheritance on mode ... to the default database when it normally requires a "no database" connection ( #24791 ). Fixed display of contrib.admin 's ForeignKey widget when it's used in a row with other fields ( #24784 ). ...
https://man.mtool.work/django/6.1/releases/1.8.2.html
クエリを作成する 8624
クエリを作成する 一度 データモデル を作成すれば、Django はデータオブジェクトの作成、取得、更新および削除を行えるようにデータベースを抽象化した API を自動的に提供します。本ドキュメントではこの API をどのように用いるかを説明します。多様なモデ ... ) email = models . EmailField () def __str__ ( self ): return self . name class Entry ( models . Model ): blog = models . ForeignKey ( Blog , on_delete = models . CASCADE ) headline = models . CharField ( max_length = 255 ) body_text = models . TextField ... save () この例では内部で UPDATE SQL 文が処理されます。明示的に save() が呼ばれるまで Django はデータベースを操作しません。 ForeignKey と ManyToManyField フィールドを扱う ForeignKey フィールドを更新するには、通常のフィールドを保存するのと全く同じように、該当 ... 参照してください。 ルックアップに指定するフィールドはモデルが持つフィールド名でなければなりません。ただし1つだけ例外があり、 ForeignKey の場合にはフィールド名の末尾に _id を付けた名前を指定できます。その場合、value パラメータには外部モデルのプライマリーキーの ...
https://man.mtool.work/django/6.1/topics/db/queries.html
Fetch modes 8499
Fetch modes New in Django 6.1. When accessing model fields that were not loaded as part of the original query, Django will fetch that field's data from the database. You can customize the behavior of this fetching with a fetch mode , making ... QuerySet : from django.db import models books = Book . objects . fetch_mode ( models . FETCH_PEERS ) Fetch modes apply to: ForeignKey fields OneToOneField fields and their reverse accessors Fields deferred with QuerySet.defer() or QuerySet.only() ジェネリッ ... models: from django.db import models class Author ( models . Model ): ... class Book ( models . Model ): author = models . ForeignKey ( Author , on_delete = models . CASCADE ) ... …and this loop: for book in books : print ( book . author . name ) …where bo ... et () . fetch_mode ( models . FETCH_PEERS ) class Book ( models . Model ): title = models . TextField () author = models . ForeignKey ( "Author" , on_delete = models . CASCADE ) objects = BookManager () ...
https://man.mtool.work/django/6.1/topics/db/fetch-modes.html
Django 1.9.5 リリースノート 8262
Django 1.9.5 リリースノート April 1, 2016 Django 1.9.5 では、1.9.4 にあったいくつかのバグを修正しました。 バグ修正 Made MultiPartParser ignore filenames that normalize to an empty string to fix crash in MemoryFileUploadHandler on specially ... fail if the storage doesn't implement path() ( #26297 ). Fixed a crash when using a reverse lookup with a subquery when a ForeignKey has a to_field set to something other than the primary key ( #26373 ). Fixed a regression in CommonMiddleware that caused ... explicit parent links ( #26413 ). Fixed a migrations crash on SQLite when renaming the primary key of a model containing a ForeignKey to 'self' ( #26384 ). Fixed JSONField inadvertently escaping its contents when displaying values after failed form validat ...
https://man.mtool.work/django/6.1/releases/1.9.5.html
contenttypes フレームワーク 8039
contenttypes フレームワーク Django には contenttypes アプリケーションが含まれており、 Django を使ったプロジェクトにインストールされているすべてのモデルを追跡し、モデルを扱うための高レベルで汎用的なインターフェースを提供します。 概要 content ... latter technique. For example, the permissions system in Django's authentication framework uses a Permission model with a foreign key to ContentType ; this lets Permission represent concepts like "can add blog entry" or "can delete news story". ContentTyp ... 実現できます。 たとえば、次のようにしてタグ付けシステムに使用できます: from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models class TaggedItem ( models . Model ... ): tag = models . SlugField () content_type = models . ForeignKey ( ContentType , on_delete = models . CASCADE ) object_id = models . PositiveBigIntegerField () content_object = GenericFor ...
https://man.mtool.work/django/6.1/ref/contrib/contenttypes.html
PREV 1 2 3 4 5 6 7 8 NEXT