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
Question 1;
Say I have a table and model called People and it has three columns - id, first_name, last_name.
If I have the following in api.py, on the /docs page I can search for people by their first name which is great. But by default it is case sensitive. Meaning, if I have Andrew in my database but I make a request for andrew, the response will be empty.
The text next to the GET button on the /docs page will be /api/people/{id}/ Get People First Name
The description on the end doesn't really make sense. It would make more sense if it said, Get People by First Name. Or even, Get People based on First Name.
Is there a way to customize that description?
Thanks.
EDIT
There is a summary param to change the description.
It looks like there is no built in mechanism for case insensitivity. I did this which seems to solve the issue. It may not make sense on its own to those reading here. But there are instances of it in the docs.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Question 1;
Say I have a table and model called
People
and it has three columns - id, first_name, last_name.If I have the following in
api.py
, on the/docs
page I can search for people by their first name which is great. But by default it is case sensitive. Meaning, if I haveAndrew
in my database but I make a request forandrew
, the response will be empty.Is it possible to turn off case sensitivity?
Question 2;
Referring to the above;
The text next to the GET button on the
/docs
page will be/api/people/{id}/ Get People First Name
The description on the end doesn't really make sense. It would make more sense if it said,
Get People by First Name
. Or even,Get People based on First Name
.Is there a way to customize that description?
Thanks.
EDIT
There is a
summary
param to change the description.https://django-ninja.dev/reference/operations-parameters/
@api.get("/hello/", summary="Say Hello")
EDIT 2
It looks like there is no built in mechanism for case insensitivity. I did this which seems to solve the issue. It may not make sense on its own to those reading here. But there are instances of it in the docs.
queryset = queryset.filter(first_name__icontains=filters.first_name)
Thanks again. This can be closed.
Beta Was this translation helpful? Give feedback.
All reactions