I’m adding a new FieldType, and following this tutorial:
https://baserow.io/docs/plugins%2Ffield-type
I’ve added the field type, the model, and have run
./dev.sh run backend manage makemigrations
./dev.sh run backend manage migrate
despite that, I get the error below when attempting to add the field from a table using the frontend. I’m going to dig into this further but I was wondering anything looked obvious to the django experts here.
You can see my diffs against the master baserow repo here: Comparing master...20220611_language_field_type · Language-Tools/vocab-ai · GitHub
ERROR 2022-06-11 13:32:15,046 django.request.log_response:230- Internal Server Error: /api/database/fields/table/260/
Traceback (most recent call last):
File "/baserow/venv/lib/python3.7/site-packages/django/db/models/options.py", line 608, in get_field
return self.fields_map[field_name]
KeyError: 'field_2021'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/baserow/venv/lib/python3.7/site-packages/asgiref/sync.py", line 482, in thread_handler
raise exc_info[1]
File "/baserow/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 38, in inner
response = await get_response(request)
File "/baserow/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 233, in _get_response_async
response = await wrapped_callback(request, *callback_args, **callback_kwargs)
File "/baserow/venv/lib/python3.7/site-packages/asgiref/sync.py", line 444, in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.7/asyncio/tasks.py", line 388, in wait_for
return await fut
File "/baserow/venv/lib/python3.7/site-packages/asgiref/current_thread_executor.py", line 22, in run
result = self.fn(*self.args, **self.kwargs)
File "/baserow/venv/lib/python3.7/site-packages/asgiref/sync.py", line 486, in thread_handler
return func(*args, **kwargs)
File "/baserow/venv/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/baserow/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/baserow/venv/lib/python3.7/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/baserow/venv/lib/python3.7/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/baserow/venv/lib/python3.7/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/baserow/venv/lib/python3.7/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/lib/python3.7/contextlib.py", line 74, in inner
return func(*args, **kwds)
File "/baserow/backend/src/baserow/api/decorators.py", line 261, in func_wrapper
return func(*args, **kwargs)
File "/baserow/backend/src/baserow/api/decorators.py", line 83, in func_wrapper
return func(*args, **kwargs)
File "/baserow/backend/src/baserow/contrib/database/api/fields/views.py", line 226, in post
).do(request.user, table, type_name, return_updated_fields=True, **data)
File "/baserow/backend/src/baserow/contrib/database/fields/actions.py", line 599, in do
**kwargs,
File "/baserow/backend/src/baserow/contrib/database/fields/handler.py", line 266, in create_field
model_field = to_model._meta.get_field(instance.db_column)
File "/baserow/venv/lib/python3.7/site-packages/django/db/models/options.py", line 610, in get_field
raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
django.core.exceptions.FieldDoesNotExist: Table260Model has no field named 'field_2021'
ERROR 2022-06-11 13:32:15,046 django.request.log_response:230- Internal Server Error: /api/database/fields/table/260/
Traceback (most recent call last):
File "/baserow/venv/lib/python3.7/site-packages/django/db/models/options.py", line 608, in get_field
return self.fields_map[field_name]
KeyError: 'field_2021'