slug python django code example
Example: using slug or .. instead of pk in django
from django.shortcuts import get_object_or_404
class TicketDetail(DetailView):
model = Ticket
def get_object(self, queryset=None):
return get_object_or_404(Ticket.objects.all(),uuid=self.kwargs.get("uuid"))