Skip to content

Tag: django

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= 2-get data based on

DJango testing multiple database application

I have django application which has two database defaultdb and externdb The application works well but when testing ,this error occurs below when trying to access the extern database This error occurs which setting should I check?? Answer Change: to this: OR You can also add databases = “extern” to this: final version: This method is what it basically suggests

How to set all available values of one model to another model in django?

I have following code i am getting stuck at when selecting available version i am only able to pick one, where i want to select all available or all the ones i require. Answer ForeignKeyField refers to one Version from MyModel You are misunderstanding the purpose of foreign keys. Your MyModel needs to be parent to all Version, that are