Django 3.2 Migrations - объект "NoneType" не имеет атрибута "_meta"
$ docker-compose exec myapp python manage.py migrate
Я получил эту ошибку после модификации моей модели, как я могу откатить или исправить проблему?
Traceback (most recent call last):
File "/src/manage.py", line 21, in <module>
main()
File "/src/manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/opt/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/opt/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/venv/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/venv/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/opt/venv/lib/python3.10/site-packages/django/core/management/base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "/opt/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 268, in handle
emit_post_migrate_signal(
File "/opt/venv/lib/python3.10/site-packages/django/core/management/sql.py", line 42, in emit_post_migrate_signal
models.signals.post_migrate.send(
File "/opt/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 180, in send
return [
File "/opt/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/opt/venv/lib/python3.10/site-packages/adminactions/models.py", line 9, in create_extra_permissions_handler
p.create_extra_permissions()
File "/opt/venv/lib/python3.10/site-packages/adminactions/perms.py", line 34, in create_extra_permissions
content_types = ContentType.objects.get_for_models(*models)
File "/opt/venv/lib/python3.10/site-packages/django/contrib/contenttypes/models.py", line 89, in get_for_models
opts_models = needed_opts.pop(ct.model_class()._meta, [])
AttributeError: 'NoneType' object has no attribute '_meta'
import uuid
from django.db import models
from myproject.packages.django_permanent.managers import MultiPassThroughManager
from myproject.packages.django_permanent.models import PermanentModel
from myproject.packages.django_permanent.query import PermanentQuerySet, DeletedQuerySet
from users.models import myprojectUser
from django.utils.translation import ugettext_lazy as _
from oauth2_provider.models import Application
class ServerFileQuerySet(PermanentQuerySet):
def get_by_natural_key(self, application_name):
return self.get(application_name=application_name)
class ApplicationHtmlInfo(PermanentModel):
class Permanent:
# If you need to restore a deleted object instead of re-creating the same one use the restore_on_create attribute:
restore_on_create = True
id = models.UUIDField(
primary_key=True, default=uuid.uuid4, editable=False, unique=True
)
application_name = models.CharField(max_length=255)
application_domain_name = models.CharField(max_length=255, default="myproject.com")
application_domain = models.CharField(max_length=255, default="myproject.com")
application_sub_domain_name = models.CharField(max_length=255, default="www.myproject.com")
application_website_url = models.CharField(max_length=255, default="https://www.myproject.com")
application_from_email = models.CharField(max_length=255, blank=True, default="myproject <notifications@myproject.com>")
application_logo_img = models.CharField(max_length=255, blank=True)
application_logo_img_dark = models.CharField(max_length=255, blank=True)
application_logo_img_light = models.CharField(max_length=255, blank=True)
application_logo_icon = models.CharField(max_length=255, blank=True)
client_id = models.ForeignKey(Application,related_name="application_html_info",on_delete=models.CASCADE,null=True,blank=True,)
application_primary_color = models.CharField(max_length=10, blank=True)
application_secondary_color = models.CharField(max_length=10, blank=True)
header_background_color = models.CharField(max_length=255, blank=True)
linear_gradient_final = models.CharField(max_length=255, blank=True)
header_background_image = models.CharField(max_length=255, blank=True)
footer_background_image = models.CharField(max_length=255, blank=True)
img_login_width = models.CharField(max_length=255, default="35", blank=True)
img_login_margin_top = models.CharField(max_length=255, default="8", blank=Tru
application_login_url = models.CharField(max_length=255, blank=True)
application_logout_url = models.CharField(max_length=255, blank=True)
application_signup_url = models.CharField(max_length=255, blank=True)
is_active = models.BooleanField(default=True)
created = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(myprojectUser, related_name="html_info_created_by", on_delete=models.CASCADE)
modified = models.DateTimeField(auto_now=True)
modified_by = models.ForeignKey(myprojectUser,related_name="html_info_modified_by",on_delete=models.CASCADE,null=True,blank=True,)
objects = MultiPassThroughManager(ServerFileQuerySet, PermanentQuerySet)
deleted_objects = MultiPassThroughManager(ServerFileQuerySet, DeletedQuerySet)
class Meta:
ordering = ("-created", "-modified")
verbose_name = _("Application Html Information")
verbose_name_plural = _("Application Html Information")