fix logging and exception

This commit is contained in:
2025-09-10 12:32:36 +02:00
parent f6e8758541
commit f5c04f9d58
2 changed files with 6 additions and 6 deletions

View File

@@ -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')