1
votes

hey people I'm new to djongo and was practicing it's usage when i keep getting this error

File "D:\python\django Rest webs\tms-REST API\BACKEND\bckend\students\models.py", line 6, in class student(models.Model): File "D:\python\django Rest webs\tms-REST API\BACKEND\bckend\students\models.py", line 7, in student pass_details=models.EmbeddedField(model_container=pass_details, null=True) File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\djongo\models\fields.py", line 225, in init super().init(model_container, *args, **kwargs) File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\djongo\models\fields.py", line 87, in init self._validate_container() File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\djongo\models\fields.py", line 91, in _validate_container for field in self.model_container._meta.get_fields(): File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options.py", line 734, in get_fields return self._get_fields(include_parents=include_parents, include_hidden=include_hidden) File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options.py", line 794, in _get_fields all_fields = self._relation_tree File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py", line 80, in get res = instance.dict[self.name] = self.func(instance) File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options.py", line 707, in _relation_tree return self._populate_directed_relation_graph() File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\db\models\options.py", line 678, in _populate_directed_relation_graph
all_models = self.apps.get_models(include_auto_created=True) File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\apps\registry.py", line 178, in get_models self.check_models_ready() File "C:\Users\Asus\AppData\Local\Programs\Python\Python38-32\lib\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.

MY Code looks like so

from djongo import models
class pass_details(models.Model):
    pass_no=models.CharField( max_length=20)
    class Meta:
        abstract = True
class student(models.Model):
    pass_details=models.EmbeddedField(model_container=pass_details, null=True)
    usn=models.CharField(max_length=10)
    name=models.CharField(max_length=20)
    objects = models.DjongoManager()
1

1 Answers

1
votes

Are you sure you are loading your models in:pass_details=models.EmbeddedField(model_container=pass_details, null=True) It seems to me that the null = True is preventing you to load your model. You can have a look again on the documentation on how to specify the parameters here: https://djongo.readthedocs.io/docs/embedded-model-field/