You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visiting /admin/cookbook/step/?all= results in a HTTP 500 error. Debug logs from 500 page included in issue.
I am able to list page 1 (of 2) steps, but navigating to page 2, or listing all steps consistently results in a HTTP 500 error. I've used the API endpoint /api/step/ to query for all steps, and can retrieve information for every one via /admin/cookbook/step/${id}/change. I suspect the database to have a bad entry with a missing field, but have been unable to manually determine which one to delete/replace/update the step.
Database is postgres at version 14 also running in docker.
Relevant logs
Environment:
Request Method: GET
Request URL: https://tandoor.domain.tld/admin/cookbook/step/?all=
Django Version: 4.2.11
Python Version: 3.12.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.postgres',
'oauth2_provider',
'django_tables2',
'corsheaders',
'crispy_forms',
'crispy_bootstrap4',
'rest_framework',
'rest_framework.authtoken',
'django_cleanup.apps.CleanupConfig',
'webpack_loader',
'django_js_reverse',
'hcaptcha',
'allauth',
'allauth.account',
'allauth.socialaccount',
'cookbook.apps.CookbookConfig',
'treebeard',
'debug_toolbar']
Installed Middleware:
['corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'cookbook.helper.scope_middleware.ScopeMiddleware',
'allauth.account.middleware.AccountMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware']
Template error:
In template /opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/templates/admin/change_list.html, error at line 68
Invalid format specifier 's if not obj.name else f': ''for object of type'str'
58 : {% block search %}{% search_form cl %}{% endblock %}
59 : {% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
60 :
61 :<form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
62 : {% if cl.formset %}
63 :<div>{{ cl.formset.management_form }}</div>
64 : {% endif %}
65 :
66 : {% block result_list %}
67 : {% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %}
68 : {% result_list cl %}
69 : {% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
70 : {% endblock %}
71 : {% block pagination %}{% pagination cl %}{% endblock %}
72 :</form>
73 :</div>
74 : {% block filters %}
75 : {% if cl.has_filters %}
76 :<div id="changelist-filter">
77 :<h2>{% translate 'Filter' %}</h2>
78 : {% if cl.has_active_filters %}<h3 id="changelist-filter-clear">
Traceback (most recent call last):
File "/opt/recipes/venv/lib/python3.12/site-packages/django/db/models/options.py", line 681, in get_field
return self.fields_map[field_name]
^^^^^^^^^^^^^^^^^^^^^^^^^^^
During handling of the above exception ('recipe_and_name'), another exception occurred:
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/utils.py", line 272, in lookup_field
f = _get_non_gfk_field(opts, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/utils.py", line 303, in _get_non_gfk_field
field = opts.get_field(name)
^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/db/models/options.py", line 683, in get_field
raise FieldDoesNotExist(
^
During handling of the above exception (Step has no field named 'recipe_and_name'), another exception occurred:
File "/opt/recipes/venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
response = response.render()
^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
self.content = self.rendered_content
^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
return template.render(context, self._request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 175, in render
return self._render(context)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/test/utils.py", line 112, in instrumented_test_render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 1005, in render
return SafeString("".join([node.render_annotated(context) fornodein self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 966, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/test/utils.py", line 112, in instrumented_test_render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 1005, in render
return SafeString("".join([node.render_annotated(context) fornodein self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 966, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 157, in render
return compiled_parent._render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/test/utils.py", line 112, in instrumented_test_render
return self.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 1005, in render
return SafeString("".join([node.render_annotated(context) fornodein self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 966, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 63, in render
result = block.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 1005, in render
return SafeString("".join([node.render_annotated(context) fornodein self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 966, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 63, in render
result = block.nodelist.render(context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 1005, in render
return SafeString("".join([node.render_annotated(context) fornodein self]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/base.py", line 966, in render_annotated
return self.render(context)
^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/templatetags/base.py", line 45, in render
returnsuper().render(context)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/template/library.py", line 258, in render
_dict = self.func(*resolved_args, **resolved_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/templatetags/admin_list.py", line 336, in result_list
"results": list(results(cl)),
^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/templatetags/admin_list.py", line 312, in results
yield ResultList(None, items_for_result(cl, res, None))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/templatetags/admin_list.py", line 303, in __init__
super().__init__(*items)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/templatetags/admin_list.py", line 213, in items_for_result
f, attr, value = lookup_field(field_name, result, cl.model_admin)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/recipes/venv/lib/python3.12/site-packages/django/contrib/admin/utils.py", line 281, in lookup_field
value = attr(obj)
^^^^^^^^^
File "/opt/recipes/cookbook/admin.py", line 188, in recipe_and_name
return f"Orphaned Step{'':s if not obj.name else f': {obj.name}'}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: ValueError at /admin/cookbook/step/
Exception Value: Invalid format specifier 's if not obj.name else f': ''for object of type'str'
The text was updated successfully, but these errors were encountered:
@smilerz can you look into this? it seems to be related to the orphaned steps function. Maybe just add a catch and deactivate the function on whatever edge case is causing this
Tandoor Version
1.5.17
Setup
Docker / Docker-Compose
Reverse Proxy
Traefik
Other
No response
Bug description
Visiting
/admin/cookbook/step/?all=
results in a HTTP 500 error. Debug logs from 500 page included in issue.I am able to list page 1 (of 2) steps, but navigating to page 2, or listing all steps consistently results in a HTTP 500 error. I've used the API endpoint
/api/step/
to query for all steps, and can retrieve information for every one via/admin/cookbook/step/${id}/change
. I suspect the database to have a bad entry with a missing field, but have been unable to manually determine which one to delete/replace/update the step.Database is postgres at version 14 also running in docker.
Relevant logs
The text was updated successfully, but these errors were encountered: