You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so im using django 3.1 and i defined a model with a foreign key relation like this:
class Account(TimeStampedModel):
corporate = models.ForeignKey('CompanyDetail',on_delete=models.CASCADE,related_name= 'corporate_accounts')
balance = models.DecimalField(max_digits=20, decimal_places=2)
this throwns an this error when I try to run the project or run migrations:
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/jet_django/apps.py", line 12, in ready
conf = JetDjangoConfiguration()
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/jet_django/configuration.py", line 28, in __init__
self.models = dict(map(lambda x: (self.model_key(x), self.serialize_model(x)), models))
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/jet_django/configuration.py", line 28, in<lambda>
self.models = dict(map(lambda x: (self.model_key(x), self.serialize_model(x)), models))
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/jet_django/configuration.py", line 185, in serialize_model
'fields': list(map(lambda field: self.serialize_field(field), fields))
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/jet_django/configuration.py", line 185, in<lambda>'fields': list(map(lambda field: self.serialize_field(field), fields))
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/jet_django/configuration.py", line 214, in serialize_field
result['params'] = {'related_model': self.serialize_related_model(field.related_model)}
File "/home/zeus-of-python/.virtualenv/lib/python3.6/site-packages/jet_django/configuration.py", line 250, in serialize_related_model
'model': Model._meta.db_table,
AttributeError: 'str' object has no attribute '_meta'
everything works fine when I manually import CompanyDetail. It also works fine when I take out jet_django from my installed apps in settings.py and urls.py file.
The text was updated successfully, but these errors were encountered:
so im using django 3.1 and i defined a model with a foreign key relation like this:
this throwns an this error when I try to run the project or run migrations:
everything works fine when I manually import
CompanyDetail
. It also works fine when I take outjet_django
from my installed apps in settings.py and urls.py file.The text was updated successfully, but these errors were encountered: