#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 )
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_futuretoTrue.
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 , 8 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 8 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 8 years ago
| Severity: | Normal → Release blocker |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:4 by , 8 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 , 8 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
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 , 8 years ago
FYI I've added a PR for this now: https://github.com/django/django/pull/9306
comment:7 by , 8 years ago
| Has patch: | set |
|---|
Sure, it would be fine to continue to allow it as a noop.