bornhack-website/profiles/views.py

17 lines
477 B
Python

from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic import DetailView
from .models import Profile
class ProfileDetail(DetailView):
model = Profile
@method_decorator(login_required)
def get(self, request, *args, **kwargs):
return super().get(request, *args, **kwargs)
def get_object(self, queryset=None):
return Profile.objects.get(user=self.request.user)