Re: Handling url in class based views.

2021-11-20 Thread Lalit Suthar
you can get that slug value from kwargs def get(self, request, *args, **kwargs): slug = self.kwargs.get("slug") also if you like to pass it in the context you can override get_context_data refer: https://ccbv.co.uk/ to know more about class based views you can refer to this playlist from

Re: Handling url in class based views.

2021-11-19 Thread Perry Bates
You can use the DetailListView from generic views. Pass in the template name, form class, and query(which in this case takes in the slug to query the db) On Mon, Nov 15, 2021, 21:27 Aadil Rashid wrote: > Hello my dear Friends, I have a question regarding Class Based Views. > > If we have a url

Re: Handling url in class based views.

2021-11-15 Thread Aadil Rashid
Thank you very much Pankaj Palmate, I really appreciate it. I have tried using def get(self, request, *args, **kwargs) but This method is not been invoked, Actually the thing is that, I am calling this ClassBasedView by an anchor tag, which passes URL to this link and I need to get the information

Re: Handling url in class based views.

2021-11-15 Thread pankaj palmate
Also request in def get itself On Tue, 16 Nov, 2021, 9:40 am pankaj palmate, wrote: > def get(self, pk, *args,**kwargs ) : > ...body.. > > On Tue, 16 Nov, 2021, 2:57 am Aadil Rashid, > wrote: > >> Hello my dear Friends, I have a question regarding Class Based Views. >> >> If

Re: Handling url in class based views.

2021-11-15 Thread pankaj palmate
def get(self, pk, *args,**kwargs ) : ...body.. On Tue, 16 Nov, 2021, 2:57 am Aadil Rashid, wrote: > Hello my dear Friends, I have a question regarding Class Based Views. > > If we have a url e.g, > path('item//', views.funView) > > We can handle it in Function Based Views,

Handling url in class based views.

2021-11-15 Thread Aadil Rashid
Hello my dear Friends, I have a question regarding Class Based Views. If we have a url e.g, path('item//', views.funView) We can handle it in Function Based Views, By simply def funView(request, slug) : #logic return render(request, "tempName") We can even pass this slug as a co