I suggest we allow fields that are only defined on an abstract base class
of a model, to be overridden by models directly inheriting the abstract
class. As fields on an abstract class are python-only, and don't live in
the database yet, they can easily be switched for another field. If you
use abstract models from sources outside your control, or if you reuse an
abstract model multiple times, this allows for some flexibility without
the need to copy the complete abstract class.
--
Ticket URL: <https://code.djangoproject.com/ticket/24305>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
WIP: https://github.com/knbk/django/tree/ticket_24305
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:2>
* has_patch: 0 => 1
Comment:
PR: https://github.com/django/django/pull/4184
Feedback welcome, especially on the documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:3>
* needs_better_patch: 0 => 1
Comment:
Chatted with Loic briefly and he indicated he didn't think the locking
approach is an appropriate implementation. The approach also needs to
integrate with the upcoming work on virtual fields, so it may take some
time to sort that out.
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:4>
* status: new => assigned
* owner: knbk => ar45
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:5>
* needs_better_patch: 1 => 0
Comment:
There is a commit here with an alternate approach:
https://github.com/knbk/django/commit/7ac5b58587ea2a153766d1601965734731609cdf
(having difficulty finding what branch it's part of so I could create a
pull request).
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:6>
Comment (by ar45):
new PR https://github.com/django/django/pull/5122
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:7>
* needs_better_patch: 0 => 1
Comment:
Tests are not passing.
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:8>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:9>
* cc: ar45 (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:10>
* needs_better_patch: 0 => 1
Comment:
The patch is missing some tests cases as noted in Loic's review.
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:11>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:12>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:13>
* cc: ramezashraf@… (added)
* stage: Ready for checkin => Accepted
Comment:
I believe that the correct ticket flow is a person other then who supplied
the patch can mark Ready For Checkin.
Kindly review
[https://docs.djangoproject.com/en/1.8/internals/contributing/new-
contributors/#new-contributors-faq]
and
[https://docs.djangoproject.com/en/1.8/internals/contributing/triaging-
tickets/]
Thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:14>
* stage: Accepted => Ready for checkin
Comment:
I reviewed the patch and asked Aron to mark the patch as such after
updating for my comments. :-)
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:15>
Comment (by RamezIssac):
I apologize for any inconvenience then :-)
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:16>
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:17>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"85ef98dc6ec565b1add417bd76808664e7318026" 85ef98dc]:
{{{
#!CommitTicketReference repository=""
revision="85ef98dc6ec565b1add417bd76808664e7318026"
Fixed #24305 -- Allowed overriding fields on abstract models.
Fields inherited from abstract base classes may be overridden like
any other Python attribute. Inheriting from multiple models/classes
with the same attribute name will follow the MRO.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24305#comment:18>