Skip to content

Tag: django-rest-framework

How To give optional parameter in DRF

Hi Everyone i am created one api, where i will use [city] as first parameter to get result based on city, but i need [id] also as second parameter but [id] is optional, same time we use [id] as second parameter and sometime not, please help me out for ex- 1-get data based on city url=127.0.0.1:8000/api/car/ci…

Python: Run a code after return something

This is an ApiView from my django project: As you see, if client.is_busy is not True, I’m making it True in here. But in this situation, I need to client.is_busy = False after 30 seconds. If I do it under client.save() code, it delays to response. How can I do it? Answer You should consider using timer …