get_object_or_404 / try-except

Run Settings
LanguagePython
Language Version
Run Command
def details(request, id): #getURL = get_object_or_404(WebtoDeepLink, pk=id) Bunun yerine try except yapılabilir try: getURL = WebtoDeepLink.objects.get(pk=id) except ObjectDoesNotExist: return JsonResponse({'error' : 'URL is not found.'}) # raise Http404 return JsonResponse({'url' : getURL.current_url})
Editor Settings
Theme
Key bindings
Full width
Lines