Closed sdbrown67 closed 2 years ago
Based off of the stack trace shown here, it looks like this issue is related to using a foreign key as the primary key for an indexed model. I notice other utility functions like has_int_pk
appear to address this case, so I think introducing a small change which does something similar for get_pk_output_field
would help here.
Traceback (most recent call last): File "/Applications/MAMP/htdocs/burning-nights-2021/manage.py", line 22, in
main()
File "/Applications/MAMP/htdocs/burning-nights-2021/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, *cmd_options)
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(args, options)
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/watson/management/commands/buildwatson.py", line 187, in handle
refreshed_model_count += rebuild_index_for_model(
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/watson/management/commands/buildwatson.py", line 73, in rebuild_index_for_model
searchengine.cleanup_modelindex(model)
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/watson/search.py", line 527, in cleanup_model_index
search_entries = self._get_deleted_entries_for_model(model)
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/watson/search.py", line 454, in _get_deleted_entries_for_model
normalized_pk=Cast(object_id_field, get_pk_output_field(model))
File "/Users/sbrown/.local/share/virtualenvs/burning-nights-2021-gAGlD6t6/lib/python3.9/site-packages/watson/models.py", line 46, in get_pk_output_field
return field_cls(field_kwargs)
TypeError: init() missing 2 required positional arguments: 'to' and 'on_delete'