... 、次の例のモデルを使います: from django.contrib.postgres.fields import IntegerRangeField from django.db import models class Event ( models . Model ): name = models . CharField ( max_length = 200 ) ages = IntegerRangeField () start = models . DateTimeFi ... 以下のオブジェクト例も使用します: >>> import datetime >>> from django.utils import timezone >>> now = timezone . now () >>> Event . objects . create ( name = "Soft play" , ages = ( 0 , 10 ), start = now ) >>> Event . objects . create ( ... name = "Pub ... 包含演算子があります。 contains , contained_by , overlap で、それぞれ SQL 演算子 @> , <@ , && が使われます。 contains ¶ >>> Event . objects . filter ( ages__contains = NumericRange ( 4 , 5 )) <QuerySet [<Event: Soft play>]> contained_by ¶ >>> Event . o ... ... 、次の例のモデルを使います: from django.contrib.postgres.fields import IntegerRangeField from django.db import models class Event ( models . Model ): name = models . CharField ( max_length = 200 ) ages = IntegerRangeField () start = models . DateTimeFi ... 以下のオブジェクト例も使用します: >>> import datetime >>> from django.utils import timezone >>> now = timezone . now () >>> Event . objects . create ( name = "Soft play" , ages = ( 0 , 10 ), start = now ) >>> Event . objects . create ( ... name = "Pub ... 包含演算子があります。 contains , contained_by , overlap で、それぞれ SQL 演算子 @> , <@ , && が使われます。 contains ¶ >>> Event . objects . filter ( ages__contains = NumericRange ( 4 , 5 )) <QuerySet [<Event: Soft play>]> contained_by ¶ >>> Event . o ... ... 除された際に JavaScript を実行したい場合、 formset:added と formset:removed イベントを使用できます。 event.detail.formsetName は行が属するフォームセットを示します。 formset:added イベントでは、 event.target は新しく追加された行で ... " {% static 'app/formset_handlers.js' %} " ></ script > {% endblock %} app/static/app/formset_handlers.js ¶ document . addEventListener ( 'formset:added' , ( event ) => { if ( event . detail . formsetName == 'author_set' ) { // Do something } }); doc ... ument . addEventListener ( 'formset:removed' , ( event ) => { // Row removed }); 注意点が2つあります: もし admin/change_form.html を継承して ... ... 除された際に JavaScript を実行したい場合、 formset:added と formset:removed イベントを使用できます。 event.detail.formsetName は行が属するフォームセットを示します。 formset:added イベントでは、 event.target は新しく追加された行で ... " {% static 'app/formset_handlers.js' %} " ></ script > {% endblock %} app/static/app/formset_handlers.js ¶ document . addEventListener ( 'formset:added' , ( event ) => { if ( event . detail . formsetName == 'author_set' ) { // Do something } }); doc ... ument . addEventListener ( 'formset:removed' , ( event ) => { // Row removed }); 注意点が2つあります: もし admin/change_form.html を継承して ... ... to run. The per-call cost of this adaptation is small: tens of microseconds in the in-request ASGI path, where the running event loop is reused, and a few hundred microseconds in the cold-start path used by management commands, background tasks, and s ... t when you are using ASGI for high in-process concurrency over non-ORM I/O (for example upstream HTTP fan-out, server-sent events, or other long-lived requests), where the extra thread per request caps that concurrency. 自分のコード上での ASGI と WSGI ... also enables the thread_sensitive mode of sync_to_async() when that wrapper is used below it. In the cold path (no running event loop) it pays the cost of starting a fresh event loop, like asyncio.run() ; when an event loop is already running (the in- ... ... to run. The per-call cost of this adaptation is small: tens of microseconds in the in-request ASGI path, where the running event loop is reused, and a few hundred microseconds in the cold-start path used by management commands, background tasks, and s ... t when you are using ASGI for high in-process concurrency over non-ORM I/O (for example upstream HTTP fan-out, server-sent events, or other long-lived requests), where the extra thread per request caps that concurrency. 自分のコード上での ASGI と WSGI ... also enables the thread_sensitive mode of sync_to_async() when that wrapper is used below it. In the cold path (no running event loop) it pays the cost of starting a fresh event loop, like asyncio.run() ; when an event loop is already running (the in- ... ... have been fixed (trailing dot removed, #23532 ). Added quoting of constraint names in the SQL generated by migrations to prevent crash with uppercase characters in the name ( #23065 ). Fixed renaming of models with a self-referential many-to-many fiel ... th cursor.execute() ( #23426 ). TEST 辞書の SERIALIZE 項目を使用可能にしました ( #23421 )。 Fixed bug in migrations that prevented foreign key constraints to unmanaged models with a custom primary key ( #23415 ). Added SchemaEditor for MySQL GIS backe ... e-aware values ( #23365 ). Added a prompt to the migrations questioner when removing the null constraint from a field to prevent an IntegrityError on existing NULL rows ( #23609 ). Fixed generic relations in ModelAdmin.list_filter ( #23616 ). Restored ... ... have been fixed (trailing dot removed, #23532 ). Added quoting of constraint names in the SQL generated by migrations to prevent crash with uppercase characters in the name ( #23065 ). Fixed renaming of models with a self-referential many-to-many fiel ... th cursor.execute() ( #23426 ). TEST 辞書の SERIALIZE 項目を使用可能にしました ( #23421 )。 Fixed bug in migrations that prevented foreign key constraints to unmanaged models with a custom primary key ( #23415 ). Added SchemaEditor for MySQL GIS backe ... e-aware values ( #23365 ). Added a prompt to the migrations questioner when removing the null constraint from a field to prevent an IntegrityError on existing NULL rows ( #23609 ). Fixed generic relations in ModelAdmin.list_filter ( #23616 ). Restored ... ... eval() and similar JavaScript functions. Strongly discouraged. UNSAFE_HASHES ¶ Represents 'unsafe-hashes' . Allows inline event handlers and some javascript: URIs when their content hashes match a policy rule. Requires CSP Level 3+. UNSAFE_INLINE ¶ R ... ... れています(たとえば、 ManyToManyField フィールド、もしくは ForeignKey フィールドの逆参照など)。 このケースを考えます: class Event ( Model ): parent = models . ForeignKey ( "self" , on_delete = models . CASCADE , related_name = "children" , ) date = mod ... els . DateField () Event . objects . order_by ( "children__date" ) ここで、それぞれの Event に対して、複数の並べ替えデータが存在する可能性があります ... ; 複数の children を伴う Event は、 order_by() が作る新たな QuerySet においてそれぞれ複数回返されることになります。言い換えれば、 QuerySet で order_by() ... 2026年10月08日