mam tę funkcję wyświetlania:Django - Catch wiele wyjątków
def forum(request):
qs = Forum.objects.all()
try:
f = Forum.objects.filter().order_by('-id')[0] <------------problem
return render_to_response("forum.html",{'qs':qs,'f':f},context_instance=RequestContext(request))
except Forum.DoesNotExist or IndexError:
return render_to_response("forum.html",{'qs':qs},context_instance=RequestContext(request))
ale nadal daje następujący błąd na linii powyżej problem:
IndexError: list index out of range
jest mój kod w porządku? Czy mogę w ten sposób wychwycić wiele wyjątków?
miło, działa jak cokolwiek: D bardzo dziękuje – doniyor