from django.shortcuts import render from django.views import View from django.http import HttpResponse, HttpRequest from django.contrib.auth.models import User from django.http import JsonResponse from .status_code import * from .models import Profile # Create your views here. class ProfilePage(View): def get(self, request: HttpRequest, id: int): query: QuerySet = Profile.objects.filter(pk=id) if (not query.exists()): return HttpResponse(PROFILE_NOT_FOUND) profile: Profile = Profile.objects.get(pk=id) return JsonResponse({'username': profile.user.username, 'title': profile.title})