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
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
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
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
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,
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
6 matches
Mail list logo