I got above error while running the makemiragtions command. So I delete/renamed the existing migration folder and rerun the makemirations command it’s is migrated but when I run the migrate I got same error i.e., TypeError: ‘class Meta’ got invalid attribute(s): manager_inheritance_from_future.
Here is my model class.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models
class CountryList(models.Model):
CHOICES =[(1, 'Active'), (0, 'Inactive')]
id = models.AutoField(primary_key=True, editable=False)
name = models.CharField(max_length=255)
iso3_code = models.CharField(max_length=5, verbose_name="ISO Code 3", help_text="ISO code with 3 leaters")
iso2_code = models.CharField(max_length=5, verbose_name="ISO Code 2", help_text="ISO code with 2 leaters")
is_active = models.IntegerField(choices=CHOICES)
def __str__(self) -> str:
return self.name
class Meta:
managed = True
db_table = 'Country_list'
verbose_name = 'Country'
verbose_name_plural = 'Countries'
ordering = ['name','is_active']
Note: I migrated from Django2.2 to Django4.2 version.
So please let me know any one have idea bout it.
Here is my entire error Trackback:
Operations to perform:
Apply all migrations: admin, auth, careers, cms, contenttypes, emailsignup, fluent_contents, news, optionsquote, press, redirects, resource, retailfinder, sessions, sites
Traceback (most recent call last):
File “/Users/developemt/Documents/Repos/Djnago_axv/manage.py”, line 10, in
execute_from_command_line(sys.argv)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/core/management/init.py”, line 442, in execute_from_command_line
utility.execute()
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/core/management/init.py”, line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/core/management/base.py”, line 412, in run_from_argv
self.execute(*args, **cmd_options)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/core/management/base.py”, line 458, in execute
output = self.handle(*args, **options)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/core/management/base.py”, line 106, in wrapper
res = handle_func(*args, **kwargs)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/core/management/commands/migrate.py”, line 302, in handle
pre_migrate_apps = pre_migrate_state.apps
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/utils/functional.py”, line 57, in get
res = instance.dict[self.name] = self.func(instance)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/db/migrations/state.py”, line 566, in apps
return StateApps(self.real_apps, self.models)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/db/migrations/state.py”, line 627, in init
self.render_multiple([*models.values(), *self.real_models])
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/db/migrations/state.py”, line 665, in render_multiple
model.render(self)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/db/migrations/state.py”, line 956, in render
return type(self.name, bases, body)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/db/models/base.py”, line 143, in new
new_class.add_to_class(“_meta”, Options(meta, app_label))
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/db/models/base.py”, line 371, in add_to_class
value.contribute_to_class(cls, name)
File “/Users/developemt/Documents/Repos/Djnago_axv/.venv/lib/python3.9/site-packages/django/db/models/options.py”, line 232, in contribute_to_class
raise TypeError(
TypeError: ‘class Meta’ got invalid attribute(s): manager_inheritance_from_future
(.venv) developemt@AXV Djnago_axv %
I have tried by adding up
manager_interface_from_future = True or False
as options in Meta class and also I comment out the entire Meta class of this class but no use.
Note: I have nother model class with Meta calss with same options.