I noticed that when exporting CSVs through the Forest Admin front-end, I was getting the following error:
Traceback (most recent call last):
File "/Users/swessel/opt/miniconda3/envs/testdbscraping/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/Users/swessel/opt/miniconda3/envs/testdbscraping/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/swessel/opt/miniconda3/envs/testdbscraping/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/swessel/opt/miniconda3/envs/testdbscraping/lib/python3.7/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/swessel/Desktop/Repos/django-forestadmin/django_forest/resources/utils/resource.py", line 13, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/Users/swessel/opt/miniconda3/envs/testdbscraping/lib/python3.7/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/Users/swessel/Desktop/Repos/django-forestadmin/django_forest/resources/views/csv.py", line 36, in get
self.fill_csv(data, writer, params)
File "/Users/swessel/Desktop/Repos/django-forestadmin/django_forest/resources/utils/csv.py", line 27, in fill_csv
res = self.fill_csv_relationships(res, record, data, params)
File "/Users/swessel/Desktop/Repos/django-forestadmin/django_forest/resources/utils/csv.py", line 19, in fill_csv_relationships
res[name] = related_res['attributes'][params[f'fields[{name}]']]
KeyError: 'id'
After a bit of debugging, I noticed that, this csv utility seems to assume that my table has a column named "id", and that foreign keys in my table are pointing towards primary key columns named "id". However, my database doesn't follow those naming conventions.
Export to CSV Bug
I noticed that when exporting CSVs through the Forest Admin front-end, I was getting the following error:
After a bit of debugging, I noticed that, this csv utility seems to assume that my table has a column named "id", and that foreign keys in my table are pointing towards primary key columns named "id". However, my database doesn't follow those naming conventions.