per page, with , order by , clip by
Results of 1 - 1 of about 1 for Ashland (0.001 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 ... "Demon Dogs" , address = "944 W. Fullerton" ) >>> p1 . save () >>> p2 = Place ( name = "Ace Hardware" , address = "1013 N. Ashland" ) >>> p2 . save () レストランを作成する。オブジェクトの主キーとして "parent" オブジェクトを渡します: >>> r = Restaurant ( ... n" ) <QuerySet [<Restaurant: Demon Dogs the restaurant>]> >>> Restaurant . objects . exclude ( place__address__contains = "Ashland" ) <QuerySet [<Restaurant: Demon Dogs the restaurant>]> これは逆方向にも機能します: >>> Place . objects . get ( pk = 1 ) < ...
https://man.mtool.work/django/6.1/topics/db/examples/one_to_one.html
PREV 1 NEXT