Re: [Django] #15610: Generic Foreign Keys break when used with multi-db.

16 views
Skip to first unread message

Django

unread,
Jan 1, 2012, 5:04:21 PM1/1/12
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: SVN
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* ui_ux: => 0
* stage: Design decision needed => Accepted


Comment:

Since this is obviously a problem, I'm marking the ticket as accepted.

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

Django

unread,
Oct 5, 2012, 1:57:01 AM10/5/12
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by esimorre):

see similar ticket #19068

--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:9>

Django

unread,
Oct 12, 2012, 7:45:48 AM10/12/12
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aalbrecht):

* cc: albrecht.andi@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:10>

Django

unread,
Apr 8, 2013, 12:02:57 PM4/8/13
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Dmitri Bogomolov <4glitch@…>):

* cc: 4glitch@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:11>

Django

unread,
May 1, 2013, 12:42:27 PM5/1/13
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Edwin <django@…>):

* cc: django@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:12>

Django

unread,
Aug 27, 2013, 4:26:55 PM8/27/13
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Joe <jac@…>):

4glitch, I think your patch would also need to address
ContentType.get_all_objects_for_this_type(). Applying the same fix that
you used for ContentType.get_object_for_this_type() seems to work for me,
i.e.:

Old:
{{{
173 return
self.model_class()._base_manager.using(self._state.db).filter(**kwargs)
}}}

New:
{{{
173 return
self.model_class()._base_manager.using(router.db_for_read
(self.model_class()) or DEFAULT_DB_ALIAS).filter(**kwargs)
}}}

That said, I haven't tested your patch or this proposed modification
thoroughly yet.

--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:13>

Django

unread,
Jun 13, 2014, 9:56:05 AM6/13/14
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by claudep):

Thanks, but tests are still missing...

--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:14>

Django

unread,
Jun 25, 2014, 6:06:49 AM6/25/14
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by socketubs):

If I understand correctly why these patches are not applied, it's just
because tests are missing ?
I can help for writing tests but I have never contributed to Django...

--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:15>

Django

unread,
Jun 25, 2014, 6:33:04 AM6/25/14
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timo):

We have [https://docs.djangoproject.com/en/dev/internals/contributing/ a
lot of documentation] with tips for new contributors. You may find the
[https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
/submitting-patches/#patch-review-checklist patch review checklist]
particularly helpful.

--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:16>

Django

unread,
Jul 11, 2014, 5:01:25 AM7/11/14
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Dmitri Bogomolov <4glitch@…>):

I cannot reproduce this issue on two sqlite databases (`test_sqlite`).
Probably need another backend.

--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:17>

Django

unread,
Oct 2, 2015, 3:58:59 PM10/2/15
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timgraham):

Might be a duplicate of #16281 as the patch proposed there also modifies
these methods.

--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:18>

Django

unread,
Jan 24, 2024, 3:56:54 PM1/24/24
to django-...@googlegroups.com
#15610: Generic Foreign Keys break when used with multi-db.
--------------------------------------+------------------------------------
Reporter: legutierr | Owner: nobody
Type: Bug | Status: new
Component: contrib.contenttypes | Version: dev

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by bcail):

* cc: bcail (added)

Comment:

The GenericForeignKey docs
(https://docs.djangoproject.com/en/5.0/ref/contrib/contenttypes/#django.contrib.contenttypes.fields.GenericForeignKey)
talk about having a ForeignKey to ContentType. Would that ForeignKey work
in this case, though, where ContentType is in a different database?
--
Ticket URL: <https://code.djangoproject.com/ticket/15610#comment:19>

Reply all
Reply to author
Forward
0 new messages