from user.models import User
from platform_backend.libs.models import ModelSerializeMixin
from djongo import models
from django.utils.timezone import now
class Blog(models.Model, ModelSerializeMixin):
name = models.CharField(max_length=100)
tagline = models.TextField()
objects = models.DjongoManager()
class Meta:
abstract = True
def __str__(self):
return str(self.name) + "-" + str(self.tagline)
class Entry(models.Model, ModelSerializeMixin):
author = models.ForeignKey(User, on_delete=models.DO_NOTHING,
related_name='user_entries')
blog = models.EmbeddedField(
model_container=Blog,
)
headline = models.CharField(max_length=255)
created_at = models.DateTimeField(default=now)
objects = models.DjongoManager()
Traceback
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
django.setup()
File "/usr/local/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/usr/local/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/src/app/mongo_test_2/models.py", line 21, in <module>
class Entry(models.Model, ModelSerializeMixin):
File "/usr/src/app/mongo_test_2/models.py", line 24, in Entry
blog = models.EmbeddedField(
File "/usr/local/lib/python3.8/site-packages/djongo/models/fields.py", line 225, in __init__
super().__init__(model_container, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/djongo/models/fields.py", line 87, in __init__
self._validate_container()
File "/usr/local/lib/python3.8/site-packages/djongo/models/fields.py", line 91, in _validate_container
for field in self.model_container._meta.get_fields():
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 750, in get_fields
return self._get_fields(include_parents=include_parents, include_hidden=include_hidden)
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 810, in _get_fields
all_fields = self._relation_tree
File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 723, in _relation_tree
return self._populate_directed_relation_graph()
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 694, in _populate_directed_relation_graph
all_models = self.apps.get_models(include_auto_created=True)
File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 178, in get_models
self.check_models_ready()
File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 140, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 377, in execute
django.setup()
File "/usr/local/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/usr/local/lib/python3.8/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/src/app/mongo_test_2/models.py", line 21, in <module>
class Entry(models.Model, ModelSerializeMixin):
File "/usr/src/app/mongo_test_2/models.py", line 24, in Entry
blog = models.EmbeddedField(
File "/usr/local/lib/python3.8/site-packages/djongo/models/fields.py", line 225, in __init__
super().__init__(model_container, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/djongo/models/fields.py", line 87, in __init__
self._validate_container()
File "/usr/local/lib/python3.8/site-packages/djongo/models/fields.py", line 91, in _validate_container
for field in self.model_container._meta.get_fields():
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 750, in get_fields
return self._get_fields(include_parents=include_parents, include_hidden=include_hidden)
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 810, in _get_fields
all_fields = self._relation_tree
File "/usr/local/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 723, in _relation_tree
return self._populate_directed_relation_graph()
File "/usr/local/lib/python3.8/site-packages/django/db/models/options.py", line 694, in _populate_directed_relation_graph
all_models = self.apps.get_models(include_auto_created=True)
File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 178, in get_models
self.check_models_ready()
File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 140, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
One line description of the issue
EmbeddedField doesn't work on Django3
Python script
python manage.py runserver
Traceback
Enviroment
Django ==3.0.5 Python ==3.8.2 Djongo ==1.3.2