Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#28750 closed Bug (fixed)

Django 2.0 should permit Meta.manager_inheritance_from_future

Reported by: Charlie Denton Owned by: Charlie Denton
Component: Database layer (models, ORM) Version: 2.0
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Charlie Denton)

I'm trying to make a library compatible with both django 1.11 and 2.0b1, but I've hit something of a snag.

I have added manager_inheritance_from_future to the Meta class of my base model, which removes the following warning:

RemovedInDjango20Warning: Managers from concrete parents will soon qualify as default managers if they appear before any other managers in the MRO. ...you can switch to the new behavior right away by setting Meta.manager_inheritance_from_future to True.

So far so good. Unfortunately, now that I've added that for django 1.11, I'm getting this error on django 2.0b1:

TypeError: 'class Meta' got invalid attribute(s): manager_inheritance_from_future

The manager_inheritance_from_future option was removed in 631f4ab06112aca5bd6a57b81159048f936050bf, but this is pretty frustrating. I'm not sure how to make this library compatible with both versions, as a result of this.

Perhaps this removal was premature?

Change History (10)

comment:1 by Charlie Denton, 7 years ago

Description: modified (diff)

comment:2 by Charlie Denton, 7 years ago

Description: modified (diff)

comment:3 by Tim Graham, 7 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Sure, it would be fine to continue to allow it as a noop.

comment:4 by Simon Charette, 7 years ago

FWIW you can branch off django.VERSION to prevent his error.

import django

class MyModel(models.Model):
    class Meta:
        if django.VERSION < (2, 0):
            manager_inheritance_from_future = True

comment:5 by Charlie Denton, 7 years ago

Owner: changed from nobody to Charlie Denton
Status: newassigned

Thanks for the workaround, Simon! I feel daft for not thinking of it myself. I'll blame the late hour, instead of my slow wits ;).

Also, thank you Tim for accepting the ticket. I'll try to add the flag as a noop.

comment:6 by Charlie Denton, 7 years ago

FYI I've added a PR for this now: https://github.com/django/django/pull/9306

comment:7 by Charlie Denton, 7 years ago

Has patch: set

comment:8 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In cbe3349:

Fixed #28750 -- Allowed models to define Meta.manager_inheritance_from_future for backwards compatibility.

Refs 631f4ab06112aca5bd6a57b81159048f936050bf.

comment:9 by Tim Graham <timograham@…>, 7 years ago

In 2e6dd975:

[2.0.x] Fixed #28750 -- Allowed models to define Meta.manager_inheritance_from_future for backwards compatibility.

Refs 631f4ab06112aca5bd6a57b81159048f936050bf.

Backport of cbe334918a0a80762249706a15b699714b5dc828 from master

comment:10 by Tim Graham <timograham@…>, 6 years ago

In da1de161:

Refs #28750 -- Removed suppport for model Meta.manager_inheritance_from_future.

Note: See TracTickets for help on using tickets.
Back to Top