per page, with , order by , clip by
Results of 1 - 1 of about 1 for Waiter (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 ... = models . BooleanField ( default = False ) def __str__ ( self ): return " %s the restaurant" % self . place . name class Waiter ( models . Model ): restaurant = models . ForeignKey ( Restaurant , on_delete = models . CASCADE ) name = models . CharFie ... ld ( max_length = 50 ) def __str__ ( self ): return " %s the waiter at %s " % ( self . name , self . restaurant ) 以下は、Python API の機能を使って実行できる操作の例です。 2つの Place を作成 ... ne_to_one.Place': 1}) >>> Restaurant . objects . all () <QuerySet [<Restaurant: Demon Dogs the restaurant>]> Restaurant に Waiter を追加します: >>> w = r . waiter_set . create ( name = "Joe" ) >>> w <Waiter: Joe the waiter at Demon Dogs the restaurant> ...
https://man.mtool.work/django/6.1/topics/db/examples/one_to_one.html
PREV 1 NEXT