Skip to content

django-admin loaddata drf_example falied #1103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SeekPoint opened this issue Nov 12, 2022 · 1 comment · Fixed by #1105
Closed

django-admin loaddata drf_example falied #1103

SeekPoint opened this issue Nov 12, 2022 · 1 comment · Fixed by #1105
Labels

Comments

@SeekPoint
Copy link

(venv) PS C:\django-rest-framework-json-api>
(venv) PS C:\django-rest-framework-json-api> django-admin loaddata drf_example --settings=example.settings
System check identified some issues:

WARNINGS:
example.Author: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.AuthorBio: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.AuthorBioMetadata: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.AuthorType: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.Blog: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.Comment: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.Company: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.Entry: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.LabResults: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.Project: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.ProjectType: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
example.TaggedItem: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tests.BasicModel: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tests.ForeignKeySource: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tests.ForeignKeyTarget: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tests.ManyToManySource: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tests.ManyToManyTarget: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
tests.NestedRelatedSource: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
Traceback (most recent call last):
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\db\models\options.py", line 668, in get_field
return self.fields_map[field_name]
KeyError: 'type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\serializers\json.py", line 70, in Deserializer
yield from PythonDeserializer(objects, **options)
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\serializers\python.py", line 131, in Deserializer
field = Model._meta.get_field(field_name)
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\db\models\options.py", line 670, in get_field
raise FieldDoesNotExist(
django.core.exceptions.FieldDoesNotExist: Author has no field named 'type'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "c:\python39\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "c:\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\django-rest-framework-json-api\venv\Scripts\django-admin.exe_main
.py", line 7, in
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\management_init
.py", line 446, in execute_from_command_line
utility.execute()
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\management_init
.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\management\base.py", line 448, in execute
output = self.handle(*args, **options)
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 102, in handle
self.loaddata(fixture_labels)
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 163, in loaddata
self.load_label(fixture_label)
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 251, in load_label
for obj in objects:
File "C:\django-rest-framework-json-api\venv\lib\site-packages\django\core\serializers\json.py", line 74, in Deserializer
raise DeserializationError() from exc
django.core.serializers.base.DeserializationError: Problem installing fixture 'C:\django-rest-framework-json-api\example\fixtures\drf_example.json':
(venv) PS C:\django-rest-framework-json-api>

@SeekPoint SeekPoint added the bug label Nov 12, 2022
@sliverc sliverc mentioned this issue Nov 14, 2022
5 tasks
@sliverc
Copy link
Member

sliverc commented Nov 14, 2022

Yep this is indeed an error. Thanks for reporting. This should be fixed once #1105 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants