per page, with , order by , clip by
Results of 1 - 1 of about 1 for Demon (0.000 sec.)
一対一 (one-to-one) 関係 9414
一対一 (one-to-one) 関係 一対一の関係を定義するには、 OneToOneField を使用します。 この例では、 Place は任意で Restaurant になることができます: from django.db import models class Place ( models . Model ): name = models . CharField ( max_len ... . restaurant ) 以下は、Python API の機能を使って実行できる操作の例です。 2つの Place を作成する: >>> p1 = Place ( name = "Demon Dogs" , address = "944 W. Fullerton" ) >>> p1 . save () >>> p2 = Place ( name = "Ace Hardware" , address = "1013 N. Ashlan ... t_dogs = True , serves_pizza = False ) >>> r . save () Restaurant は自身の place にアクセスできます: >>> r . place <Place: Demon Dogs the place> Place は自身の restaurant に、利用可能ならアクセスできます: >>> p1 . restaurant <Restaurant: Demon Dogs th ... the place> また、place を逆方向の割り当てを使用してセットします: >>> p1 . restaurant = r >>> p1 . restaurant <Restaurant: Demon Dogs the restaurant> オブジェクトを1対1のリレーションシップに割り当てるには、オブジェクトを保存する必要があることに注意して ...
https://man.mtool.work/django/6.1/topics/db/examples/one_to_one.html
PREV 1 NEXT