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
Records containing DateTime type as a composite primary key can be viewed and edited.
Actual behavior
Server error.
Debugging material
Traceback
Traceback (most recent call last):
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
raise exc
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
await self.app(scope, receive, _send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 460, in handle
await self.app(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
raise exc
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
await self.app(scope, receive, _send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/middleware/sessions.py", line 85, in __call__
await self.app(scope, receive, send_wrapper)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/sqladmin/authentication.py", line 68, in wrapper_decorator
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/sqladmin/application.py", line 467, in details
model = await model_view.get_object_for_details(request.path_params["pk"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/sqladmin/models.py", line 844, in get_object_for_details
stmt = self._stmt_by_identifier(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/sqladmin/models.py", line 862, in _stmt_by_identifier
values = object_identifier_values(identifier, self.model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jsaito/git/myproject/.venv/lib/python3.12/site-packages/sqladmin/helpers.py", line 231, in object_identifier_values
value = False if part == "False" else type_(part)
^^^^^^^^^^^
TypeError: 'str' object cannot be interpreted as an integer
Checklist
master
.Describe the bug
Opening a record with a DateTime type column in the composite primary key will result in a 500 error.
The object_identifier_values() function in helper.py fails to convert to Python's datetime.datetime type, resulting in an error.
Steps to reproduce the bug
The test code to reproduce is below.
Expected behavior
Records containing DateTime type as a composite primary key can be viewed and edited.
Actual behavior
Server error.
Debugging material
Traceback
Environment
Additional context
PR #859
The text was updated successfully, but these errors were encountered: