Re: [Django] #7623: Multi-table inheritance: Add the ability create child instance from existing parent

25 views
Skip to first unread message

Django

unread,
Oct 26, 2015, 5:49:08 PM10/26/15
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner:
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* owner: elektrrrus =>
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:36>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 11, 2017, 2:45:41 AM10/11/17
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)

Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sergey Fedoseev):

* cc: Sergey Fedoseev (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:37>

Django

unread,
Jul 30, 2018, 1:11:02 PM7/30/18
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by kamandol):

* cc: kamandol (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:38>

Django

unread,
Mar 20, 2019, 5:59:25 AM3/20/19
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlos Palol):

* cc: Carlos Palol (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:39>

Django

unread,
Dec 28, 2019, 8:03:56 PM12/28/19
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mrodal):

* cc: mrodal (added)


Comment:

wow, 11 years.. and it seems so simple to be able to insert a row with 1
FK and the child fields..

--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:40>

Django

unread,
Dec 15, 2020, 4:14:28 AM12/15/20
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Bel-Shazzar):

* cc: Bel-Shazzar (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:41>

Django

unread,
Jul 30, 2021, 8:37:21 PM7/30/21
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev

(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by InvalidInterrupt):

* cc: InvalidInterrupt (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:42>

Django

unread,
Jul 30, 2021, 11:29:27 PM7/30/21
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sergey Fedoseev):

* cc: Sergey Fedoseev (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:43>

Django

unread,
Aug 17, 2022, 4:54:49 AM8/17/22
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by JM Barbier):

* cc: JM Barbier (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:44>

Django

unread,
Sep 11, 2023, 11:46:20 AM9/11/23
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Charlie Denton):

* cc: Charlie Denton (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:45>

Django

unread,
Sep 11, 2023, 11:47:51 AM9/11/23
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Charlie Denton):

I'm in the process of refactoring some code to remove use of multi-table
inheritance, and the ability to create these tables separately would be
very useful to me as a part of the refactor.

--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:46>

Django

unread,
Sep 11, 2023, 12:27:11 PM9/11/23
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

I wonder if the newly introduced `force_insert` feature in Django 5.0 (not
released yet) that allows specifying which tables should be inserted
happens to address this issue see (#30382 and
a40b0103bccb8216c944188d329d8ea5eceb7e92).


To take the initially reported use case

{{{#!python
parent = Restaurant.objects.get(name__iexact="Bob's Place").parent
bar = Bar(parent=parent, happy_hour=True)
bar.save(force_insert=(Bar,))
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:47>

Django

unread,
Dec 24, 2023, 5:46:02 PM12/24/23
to django-...@googlegroups.com
#7623: Multi-table inheritance: Add the ability create child instance from
existing parent
-------------------------------------+-------------------------------------
Reporter: brooks.travis@… | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: model-inheritance, | Triage Stage: Accepted
multi-table-inheritance |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by HAMA Barhamou):

if this method worked:

{{{
extended_user = ExtendedUser(user_ptr_id=auth_user.pk)
extended_user.__dict__.update(auth_user.__dict__)
extended_user.save()
}}}


here: [https://stackoverflow.com/questions/4064808/django-model-
inheritance-create-sub-instance-of-existing-instance-downcast]

why not simply use it under the hood of django. Too easy. there must be
something I've missed. **I wonder what it is. do you have an idea?** or
maybe it's not enough to cover all scenarios.

--
Ticket URL: <https://code.djangoproject.com/ticket/7623#comment:48>

Reply all
Reply to author
Forward
0 new messages