V
V
Vitaly Ananiev2022-02-06 19:00:17
Django
Vitaly Ananiev, 2022-02-06 19:00:17

How to get slug in DetailView?

I can get the slug using functions in views, let's say:

def addAvailability(request, slug):
    games = Games.objects.get(id_num=slug)

but how do i get the slug in the DetailView? is there a special function? please tell me this will greatly facilitate the writing of repeatable code.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2022-02-06
@bacon

Ok Google, "django DetailView get slug"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question