ms@Marcuss-MacBook-Pro-2 myhentai % python3 manage.py startapp webapp
Traceback (most recent call last):
File "/Users/ms/Software/myhent.ai/myhent/myhentai/manage.py", line 22, in
main()
File "/Users/ms/Software/myhent.ai/myhent/myhentai/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/homebrew/lib/python3.11/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/homebrew/lib/python3.11/site-packages/django/core/management/init.py", line 420, in execute
django.setup()
File "/opt/homebrew/lib/python3.11/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/homebrew/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/opt/homebrew/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/ms/Software/myhent.ai/myhent/myhentai/webapp/models.py", line 3, in
class User(models.Model):
File "/Users/ms/Software/myhent.ai/myhent/myhentai/webapp/models.py", line 8, in User
created_image_ids = models.ArrayField(models.ObjectIdField(), default=list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/djongo/models/fields.py", line 273, in init
super().init(model_container, *args, **kwargs)
File "/opt/homebrew/lib/python3.11/site-packages/djongo/models/fields.py", line 112, in init
self._validate_container()
File "/opt/homebrew/lib/python3.11/site-packages/djongo/models/fields.py", line 116, in _validate_container
for field in self.model_container._meta._get_fields(reverse=False):
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ObjectIdField' object has no attribute '_meta'
I'm storing images in image model and want to store the id into the user model when an image is created.
from djongo import models
class User(models.Model): username = models.CharField(max_length=30) email = models.EmailField(unique=True) password = models.CharField(max_length=100) anonymous = models.BooleanField(default=False) created_image_ids = models.ArrayField(models.ObjectIdField(), default=list) liked_image_ids = models.ArrayField(models.ObjectIdField(), default=list) email_confirmed = models.BooleanField(default=False)
class Image(models.Model): user_id = models.ObjectIdField() prompt = models.CharField(max_length=100) image_data = models.BinaryField() likes_count = models.IntegerField(default=0)
ms@Marcuss-MacBook-Pro-2 myhentai % python3 manage.py startapp webapp
main()
File "/Users/ms/Software/myhent.ai/myhent/myhentai/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/homebrew/lib/python3.11/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/homebrew/lib/python3.11/site-packages/django/core/management/init.py", line 420, in execute
django.setup()
File "/opt/homebrew/lib/python3.11/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/homebrew/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/opt/homebrew/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/ms/Software/myhent.ai/myhent/myhentai/webapp/models.py", line 3, in
class User(models.Model):
File "/Users/ms/Software/myhent.ai/myhent/myhentai/webapp/models.py", line 8, in User
created_image_ids = models.ArrayField(models.ObjectIdField(), default=list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/djongo/models/fields.py", line 273, in init
super().init(model_container, *args, **kwargs)
File "/opt/homebrew/lib/python3.11/site-packages/djongo/models/fields.py", line 112, in init
self._validate_container()
File "/opt/homebrew/lib/python3.11/site-packages/djongo/models/fields.py", line 116, in _validate_container
for field in self.model_container._meta._get_fields(reverse=False):
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ObjectIdField' object has no attribute '_meta'
Traceback (most recent call last): File "/Users/ms/Software/myhent.ai/myhent/myhentai/manage.py", line 22, in