Д
because the correct answer to "how do I save it to the DB" should be the same except changing only the 'saving code'
Abolfazl
Hi everybody.
Abolfazl
I have a question
Abolfazl
how can i manage the requests in django rest framework
Д
I have a question
I have an answer: put some lotion on it and don't play with it for a week
Д
how can i manage the requests in django rest framework
what do you mean by "manage requests"?
Abolfazl
I have an answer: put some lotion on it and don't play with it for a week
Oh sorry My English language is not very good and i cant your Purpose !
Д
mange the requests OK ?!
yes. what do you want to do with the requests in DRF?
Abolfazl
Abolfazl
yes. what do you want to do with the requests in DRF?
Look . I have a Token Refresh View . okay
Abolfazl
can you show code?
no excuse me.
Abolfazl
i want when a request is come the next request wait for response of the first request ok?
Abolfazl
after that proccess the secound request
Д
i want when a request is come the next request wait for response of the first request ok?
okay; so: the CLIENT (=Abolfazi) sends a Request to Django. Django listens. Django takes the Request and starts processing. Then CLIENT sends NEW request. Django listens but WAITS?
Abolfazl
the first request has valid token but the secound request does not have
Д
is this a client problem or a backend problem?
Abolfazl
why
we have two tokens . access and refresh token . each have life time . access token is for example 5 minutes and refresh token 90 days
Abolfazl
Abolfazl
can i continue ?
Д
just to make sure this doesn't solve the problem: django has JWT extensions
Д
yes yes
does this help https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
Abolfazl
when the access token is expired we should send request to RefreshToken view with refresh token in request body
Abolfazl
the first request is done and jwt send the refresh token in black list.
Abolfazl
right now the secound request has invalid token for refresh the access token ok ?!
Abolfazl
This error occurs when we send two request to refresh token view at same time
Abolfazl
I want to keep the next request until the previous request is answered
Abolfazl
my front-end is React-js with axios library and back-end is DRF
Abolfazl
what is the error
for the secound request is " Token is black listed "
Abolfazl
In this case, jwt does not care about the answer to the first request, but it is processed
Д
for the secound request is " Token is black listed "
are you using the same refresh token on both calls or a different one
Abolfazl
are you using the same refresh token on both calls or a different one
same refresh token on both calls because the response of first request has not come
Anonymous
Hi everyone How can I make user requiered to complete profile info first before checking out? If the user didn't create the profile yet, I wanna redirect them to that url
Д
same refresh token on both calls because the response of first request has not come
but do you get a new refresh token and is the new access token valid?
Д
or am I misunderstanding something
Д
the refresh endpoint gives you a new access + refresh token right
Abolfazl
but we can get it
Abolfazl
can not
Д
well if the refresh token changes, then you're not supposed to get more than one new token per refresh
Д
one refresh per refresh token
Д
are you saying if you do a double-call, you get ZERO tokens?
Abolfazl
Д
we get the Token is blacklisted error
okay I understand the error now
Д
we get the Token is blacklisted error
it sounds weird that this basic of a situation would not have been handled by JWT extensions
Д
thank God
also maybe change the tone a bit if you want me to spend my energy?
Abolfazl
also maybe change the tone a bit if you want me to spend my energy?
i could not understand your Purpose excuse me ?!
Dostow
hello, anyone knows how can i use django and drf views in the same app? It's been difficult for me to check if a request is made from an authorized user
Д
So what is the solution
I have no idea - I'm googling
Abolfazl
I have no idea - I'm googling
Ok thanks. can you explain my bug to other members and pin that maybe someone found and help me. because i cant explain it very well.
Abolfazl
I have no idea - I'm googling
ok if you have find any things please say to me thanks a lot
Dostow
Can someone help me to know if this function based view is correct? I'm using cors-headers:
Dostow
https://dpaste.org/pzZMG
Chikal
Anyone pls ??
How we can help?
Jorge
So how do you need help?
Jorge
You can use AJAX to accomplish that behavior
Kay
You can use AJAX to accomplish that behavior
He's asking that how can he structure the backend for that
Brutus
Actually I'm rendering some data from a model and on html page I have added a button so that when I click the vacancy in that model decreases by one and another field called participants gets name of the current user stored in it