... a parent model with related model inlines, where the user has view-only permissions to a parent model but edit permissions to the i ... nline model, would display a read-only view of the parent model but editable forms for the inline. Submitting these forms would not allow direct edits to the parent model, but woul ... d trigger the parent model's save() method, and cause pre and post-save signal handlers to be invoked. This is a privilege escalation as a user ... ... isplaying a parent model with related model inlines, where the user has view-only permissions to a parent model but edit permissions to the i ... nline model, would display a read-only view of the parent model but editable forms for the inline. Submitting these forms would not allow direct edits to the parent model, but woul ... d trigger the parent model's save() method, and cause pre and post-save signal handlers to be invoked. This is a privilege escalation as a user ... ... ance with to_field If you're using multiple table model inheritance , be aware of this caveat: child models using a custom parent_link and to_field will cause database integrity errors. A set of models like the following are not valid : class Parent ( ... Model ): name = models . CharField ( max_length = 10 ) other_value = models . IntegerField ( unique = True ) class Child ( Parent ): father = models . OneToOneField ( Parent , primary_key = True , to_field = "other_value" , parent_link = True ) value = ... ... カーソルは区別できないため、一意な列名を想定しています。 この3つの違いの例を挙げましょう: >>> cursor . execute ( "SELECT id, parent_id FROM test LIMIT 2" ) >>> cursor . fetchall () ((54360982, None), (54360880, None)) >>> cursor . execute ( "SELECT id, p ... arent_id FROM test LIMIT 2" ) >>> dictfetchall ( cursor ) [{'parent_id': None, 'id': 54360982}, {'parent_id': None, 'id': 54360880}] >>> cursor . execute ( "SELECT id, parent_id FROM test LI ... MIT 2" ) >>> results = namedtuplefetchall ( cursor ) >>> results [Result(id=54360982, parent_id=None), Result(id=54360880, parent_id=None)] >>> results [ 0 ] . id 54360982 >>> results [ 0 ][ 0 ] 54360982 コネクション ... ... . Use new inline syntax The new edit_inline options have all been moved to admin.py . Here's an example: Old (0.96): class Parent ( models . Model ): ... class Child ( models . Model ): parent = models . ForeignKey ( Parent , edit_inline = models . STA ... CKED , num_in_admin = 3 ) New (1.0): class ChildInline ( admin . StackedInline ): model = Child extra = 3 class ParentAdmin ( admin . ModelAdmin ): model = Parent inlines = [ ChildInline ] admin . site . register ( Parent , ParentAdmin ) See ... ... hen using save_as_new ( #28159 ). Fixed a regression where Model._state.db wasn't set correctly on multi-table inheritance parent models after saving a child model ( #28166 ). Corrected the return type of ArrayField(CITextField()) values retrieved from ... pendency as of Django 1.11.) Fixed a regression causing __in lookups on a foreign key to fail when using the foreign key's parent model as the lookup value ( #28175 ). ... ... できます。 参考 完全な実装例は、 1対1リレーションモデルの例 を参照してください。 OneToOneField フィールドには、オプションの parent_link 引数を指定することもできます。 以前は OneToOneField クラスが自動的にモデルの主キーになっていました。しかし、現在はそう ... 連付けられた OneToOneField が自動生成されます。 place_ptr = models . OneToOneField ( Place , on_delete = models . CASCADE , parent_link = True , primary_key = True , ) Restaurant 上で、自分自身の OneToOneField を parent_link=True を付けて宣言すれば、この ... を持っているが、子モデルに既定のデータ並び順を持たせたくない場合は、下記のように明示的に無効化できます。 class ChildModel ( ParentModel ): # ... class Meta : # Remove parent's ordering effect ordering = [] 継承と関係の逆引き Because multi-table inherita ... ... s_url は辞書文字列のフォーマットを含むことができ、オブジェクトのフィールド属性に対して補間されます。例えば、 success_url="/parent/{parent_id}/" を使用すると、モデルの parent_id フィールドから構成される URL にリダイレクトできます。 delete ( request , * ... ... tably crafted tolerance . バグ修正 Fixed a data loss possibility in the select_for_update() . When using related fields or parent link fields with マルチテーブル継承 in the of argument, the corresponding models were not locked ( #31246 ). ... ... ixed a bug in Django 3.2 where a system check would crash on a model with a reverse many-to-many relation inherited from a parent class ( #32947 ). ... 2026年10月08日