django-daiquiri / daiquiri

A framework for the publication of scientific databases
https://escience.aip.de/daiquiri
Apache License 2.0
26 stars 8 forks source link

BUG: search field not found -- Internal Server error #52

Closed agy-why closed 1 year ago

agy-why commented 4 years ago

CONTEXT

In a daiquiri instance, when the admin type in something in the search field of the Django admin interface of Query and actually search for it - Internal Server error is produced.

PROBLEM

Django gives this Error:

FieldError at /admin/daiquiri_query/downloadjob/
Cannot resolve keyword 'schema_name' into field. Choices are: client_ip, creation_time,
destruction_time, end_time, error_summary, execution_duration, format_key, id, job,
job_id, job_ptr, job_ptr_id, job_type, max_records, owner, owner_id, phase,
response_format, run_id, start_time

Looking at daiquiri/daiquiri/query/admin.py one sees the origin of the error message:

class DownloadJobAdmin(JobAdmin):
    search_fields = JobAdmin.search_fields + ['schema_name', 'job__table_name', 'format_key']
    list_display = JobAdmin.list_display + ['job', 'file_path']
    actions = ['abort_job', 'archive_job']

It seems that these fields are not present in the JobAdmin keys.

Suggestion

schema_name is not in the available keys but maybe behind one: job__schema_name

On could replace schema_name with <some_key>__schema_name. Just need to find which key is the correct one.

agy-why commented 1 year ago

see #116