... ステップで作成・追加するには create() を使います: >>> new_publication = a2 . publications . create ( title = "Highlights for Children" ) Article オブジェクトはリレーション先の Publication オブジェクトにアクセスできます: >>> a1 . publications . all () <Quer ... ySet [<Publication: The Python Journal>]> >>> a2 . publications . all () <QuerySet [<Publication: Highlights for Children>, <Publication: Science News>, <Publication: Science Weekly>, <Publication: The Python Journal>]> Publication オブジェクト ... l>]> >>> Publication . objects . filter ( article__headline__startswith = "NASA" ) <QuerySet [<Publication: Highlights for Children>, <Publication: Science News>, <Publication: Science Weekly>, <Publication: The Python Journal>]> >>> Publication . object ... ... ステップで作成・追加するには create() を使います: >>> new_publication = a2 . publications . create ( title = "Highlights for Children" ) Article オブジェクトはリレーション先の Publication オブジェクトにアクセスできます: >>> a1 . publications . all () <Quer ... ySet [<Publication: The Python Journal>]> >>> a2 . publications . all () <QuerySet [<Publication: Highlights for Children>, <Publication: Science News>, <Publication: Science Weekly>, <Publication: The Python Journal>]> Publication オブジェクト ... l>]> >>> Publication . objects . filter ( article__headline__startswith = "NASA" ) <QuerySet [<Publication: Highlights for Children>, <Publication: Science News>, <Publication: Science Weekly>, <Publication: The Python Journal>]> >>> Publication . object ... ... te_parent () try : with transaction . atomic (): generate_relationships () except IntegrityError : handle_exception () add_children () この例では、 generate_relationships() が整合性制約を破ってデータベースエラーを起こしたとしても、 add_children() でクエリ ... ... te_parent () try : with transaction . atomic (): generate_relationships () except IntegrityError : handle_exception () add_children () この例では、 generate_relationships() が整合性制約を破ってデータベースエラーを起こしたとしても、 add_children() でクエリ ... ... スを考えます: class Event ( Model ): parent = models . ForeignKey ( "self" , on_delete = models . CASCADE , related_name = "children" , ) date = models . DateField () Event . objects . order_by ( "children__date" ) ここで、それぞれの Event に対して、複数の ... 並べ替えデータが存在する可能性があります; 複数の children を伴う Event は、 order_by() が作る新たな QuerySet においてそれぞれ複数回返されることになります。言い換えれば、 QuerySet で ... ... スを考えます: class Event ( Model ): parent = models . ForeignKey ( "self" , on_delete = models . CASCADE , related_name = "children" , ) date = models . DateField () Event . objects . order_by ( "children__date" ) ここで、それぞれの Event に対して、複数の ... 並べ替えデータが存在する可能性があります; 複数の children を伴う Event は、 order_by() が作る新たな QuerySet においてそれぞれ複数回返されることになります。言い換えれば、 QuerySet で ... 2026年10月08日