sbywater/django-asana

Invalid field name(s) for model CustomField:

Closed this issue · 5 comments

Installed a fresh django 2.1.x to run with django-asana.

getting the following error when running the sync.

"', '".join(sorted(invalid_params)),

django.core.exceptions.FieldError: Invalid field name(s) for model CustomField: 'is_global_to_workspace'.

Asana has not updated their API documentation to include this new field. Can you give me the entire response from Asana for this CustomField instance so I can see what the datatype is (I expect boolean) and if there are any other new fields that need to be added? I can add a migration to support this, or you can add it and a migration for it and submit a pull request. Thanks for the report.

Would love to contribute... but might be a bit over my head. I'll look through the model to see if I can figure it out. below is the complete error code.

Synchronizing data from Asana.
Successfully synced 0 events for project Parkhill.
Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/Django-2.1.11.dev20190701082148-py3.6.egg/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/Django-2.1.11.dev20190701082148-py3.6.egg/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/Django-2.1.11.dev20190701082148-py3.6.egg/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/Django-2.1.11.dev20190701082148-py3.6.egg/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/djasana/management/commands/sync_from_asana.py", line 91, in handle
self._sync_workspace_id(workspace_id, projects, models)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/djasana/management/commands/sync_from_asana.py", line 400, in _sync_workspace_id
self._check_sync_project_id(project_id, workspace, models)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/djasana/management/commands/sync_from_asana.py", line 141, in _check_sync_project_id
is_archived = self._sync_project_id(project_id, models)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/djasana/management/commands/sync_from_asana.py", line 251, in _sync_project_id
project = sync_project(self.client, project_dict)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/djasana/utils.py", line 110, in sync_project
client, custom_field_settings, project_dict['workspace_id'], project.remote_id)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/djasana/utils.py", line 165, in sync_custom_fields
remote_id=custom_field_remote_id, defaults=custom_field_dict)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/Django-2.1.11.dev20190701082148-py3.6.egg/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/Django-2.1.11.dev20190701082148-py3.6.egg/django/db/models/query.py", line 498, in update_or_create
lookup, params = self._extract_model_params(defaults, **kwargs)
File "/root/cr2/cr_env2.1/lib/python3.6/site-packages/Django-2.1.11.dev20190701082148-py3.6.egg/django/db/models/query.py", line 558, in _extract_model_params
"', '".join(sorted(invalid_params)),
django.core.exceptions.FieldError: Invalid field name(s) for model CustomField: 'is_global_to_workspace'.

I updated the models.py to account for the new field.

Did it work after you added the field, or were there other missing fields? I'm trying to avoid making multiple migrations if there are indeed multiple new fields that Asana has added. Outputting the value of custom_field_dict /djasana/utils.py", line 165 would tell me what I'm looking for.

Fixed in v1.4.1