Re: DRF Invalid value Error

2023-03-30 Thread Umair Ramzan
You have to replace the field with relevant model field name in your identification Model. On Thu, 30 Mar 2023, 18:07 Amed Sheriff, wrote: > Hello @Umair Ramzan, > > Please with your approach i am getting this error. > Code: > > userid = serializers.SlugRelatedField( &g

Re: DRF Invalid value Error

2023-03-29 Thread Umair Ramzan
You can overrite the to_internal_value method in the serializer. Field - candidate key --- def to_internal_value(self, data): userid = Identification.obejcts.get(field=data["userid"]).id resource = data.copy().update({'userid':userid}) return super().to_internal_value(resource) On

Re: terminal output to html page

2022-09-12 Thread Umair Ramzan
Can you provide a bit of context what you are trying to do? Do you want your users to execute code on your server? On Mon, 12 Sep 2022, 11:25 Sohail Khan, wrote: > hey guys can we print output of a command which has been executed on > terminal to a html page in django its possible in python but

Re: safe delete

2022-09-05 Thread Umair Ramzan
bscribe from this group and stop receiving emails from it, send an > email to django-rest-framework+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-rest-framework/df9f2e2b-1608-4a22-b66d-6636f63cb1c2n%40googlegroups.com > &l

Re: safe delete

2022-09-05 Thread Umair Ramzan
To implement safe delete you have to override the model's delete functionality. There is nothing to do with restframework. Also there exists a package called djago-safedelete. On Mon, 5 Sep 2022, 15:59 Sohail Khan, wrote: > hey guys can we implement safe delete in django rest framework if yes h

Re: 405 Method Not Allowed

2022-08-05 Thread Umair Ramzan
By default browsers makes GET requests. So you need to use some other Clients such as postman to test your api. On Fri, 5 Aug 2022, 13:00 Salima Begum, wrote: > Hi, > I am new to Django rest framework. In my project I have written api view > for phone OTP verification there If I use api_view(['P

Re: Query on building a business logic layer using django rest framework

2021-09-02 Thread Umair Ramzan
You can always use the functions avaible on Django Queryset and Models. You can build your business logic by manipulating the data. a better way to do this is to separate your business logic from the view and models. you can always write a function let's say "def my_business_logic" with all the