In the proposed patch at
https://github.com/akaariai/django/tree/related_rel_removal the
RelatedObject usage is removed. The idea is to make ForeignObjectRel to
work exactly like RelatedObject worked and provide the same instance from
field.rel and field.related.
I've opted for deprecation path where RelatedObject can still be used, and
so can field.related, too. The field.related attribute is actually
ForeignObjectRel, but by usage of `__instancecheck__`
isinstance(field.related, RelatedObject) answers yes. This should make
this change easy for 3rd party apps.
--
Ticket URL: <https://code.djangoproject.com/ticket/21414>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: loic@… (added)
* needs_better_patch: => 1
* needs_tests: => 0
* version: 1.6 => master
* needs_docs: => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted
Comment:
Looking pretty good.
I left a couple of comments on commit
[https://github.com/akaariai/django/commit/8d63a8efb21c5f08f0a0beb1200eaa78017f52e0
8d63a8e] (linking to it since these are lost on rebase).
Dunno if it's an omission or still on the todo list, but it's missing the
deprecation docs.
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:1>
Comment (by akaariai):
I am no sure about docs. This is completely private API...
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:2>
Comment (by loic84):
By docs I meant `docs/internals/deprecation.txt`, dunno if this document
is meant for public consumption or for internal housekeeping.
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:3>
Comment (by aaugustin):
It's only for public APIs.
If we know that a private API is used in the wild, we might mention it
there, but that's an exception.
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:4>
* needs_docs: 1 => 0
Comment:
All good, I wrongly assumed it was a TODO list for when the new dev branch
is created.
So yes, it's not needed here since this is very much private APIs.
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:5>
Comment (by timgraham):
Anssi, do you think there is much work to do to incorporate this in 1.8?
Might it simply the `_meta` refactor or should we try to merge that branch
first?
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:6>
* owner: nobody => timgraham
* status: new => assigned
Comment:
I'm trying to update this to apply cleanly.
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:7>
* needs_better_patch: 1 => 0
Comment:
[https://github.com/django/django/pull/3757 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f233bf47dde1d481108142c8d6b4bb3b3d8c6d08"]:
{{{
#!CommitTicketReference repository=""
revision="f233bf47dde1d481108142c8d6b4bb3b3d8c6d08"
Fixed #21414 -- Removed RelatedObject and deprecated Field.related.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:9>
Comment (by phoebebright):
Found two apps failing as they are using RelatedObject, django-taggit and
django-import-export.
To fix, would I be right in thinking it is a case of replacing
from django.db.models.fields.related import ForeignObjectRel
with
from django.db.models.related import RelatedObject
and all instances of RelatedObject with ForeignObjectRel
?
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:10>
Comment (by timgraham):
Yes
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:11>
Comment (by Tim Graham <timograham@…>):
In [changeset:"96317ad8defa89a9a4e8ecf4e22e64cb0c3054d7" 96317ad8]:
{{{
#!CommitTicketReference repository=""
revision="96317ad8defa89a9a4e8ecf4e22e64cb0c3054d7"
Refs #21414 -- Removed Field.related per deprecation timeline.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21414#comment:12>