fix logging and exception
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, redirect
|
||||
from lettings.models import Letting
|
||||
import logging
|
||||
|
||||
@@ -31,6 +31,6 @@ def letting(request, letting_id):
|
||||
}
|
||||
print("that")
|
||||
return render(request, 'lettings/letting.html', context)
|
||||
except:
|
||||
except ValueError:
|
||||
logger.error(f"letting id : {letting_id} not found")
|
||||
index(request)
|
||||
return redirect('lettings_index')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, redirect
|
||||
from profiles.models import Profile
|
||||
import logging
|
||||
|
||||
@@ -27,6 +27,6 @@ def profile(request, username):
|
||||
profile = Profile.objects.get(user__username=username)
|
||||
context = {'profile': profile}
|
||||
return render(request, 'profiles/profile.html', context)
|
||||
except:
|
||||
except (ValueError, Profile.DoesNotExist):
|
||||
logger.error(f"Username : {username} doesn't exist")
|
||||
index(request)
|
||||
return redirect('profiles_index')
|
||||
Reference in New Issue
Block a user