test-farid/album/views.py

39 lines
1.3 KiB
Python

from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.views.generic import CreateView, TemplateView
# Create your views here.
class HomePageView(TemplateView):
template_name = 'album/homepage.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# NOTE: This will be used to update the active window in navbar
context.update({
'contact_us_create': 'active'
})
return context
# def post(self, request, *args, **kwargs) -> HttpResponse:
# data = {
# 'user': request.user.id,
# 'title': request.POST.get('title'),
# 'description': request.POST.get('description'),
# 'inquiry_type': request.POST.get('inquiry_type'),
# }
# serializer = ContactUsCreateSerializer(data=data)
# serializer.is_valid(raise_exception=True)
# instance = serializer.save()
# send_new_inquiry_notification.delay(instance.id)
# messages.success(self.request, 'Enquiry submitted successfully.')
# return HttpResponseRedirect('/dashboard')