Add cache_control decorator to all hosting views

This commit is contained in:
PCoder 2017-12-25 15:10:34 +01:00
parent dd54b3052e
commit b4f03b9553

View file

@ -65,6 +65,7 @@ CONNECTION_ERROR = "Your VMs cannot be displayed at the moment due to a \
minutes."
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class DashboardView(LoginRequiredMixin, View):
template_name = "hosting/dashboard.html"
login_url = reverse_lazy('hosting:login')
@ -186,6 +187,7 @@ class HostingPricingView(ProcessVMSelectionMixin, View):
return render(request, self.template_name, context)
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class IndexView(View):
template_name = "hosting/index.html"
@ -210,6 +212,7 @@ class IndexView(View):
return render(request, self.template_name, context)
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class LoginView(LoginViewMixin):
template_name = "hosting/login.html"
form_class = HostingUserLoginForm
@ -310,6 +313,7 @@ class SignupValidatedView(SignupValidateView):
return context
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class ResendActivationEmailView(ResendActivationLinkViewMixin):
template_name = 'hosting/resend_activation_link.html'
form_class = ResendActivationEmailForm
@ -318,6 +322,7 @@ class ResendActivationEmailView(ResendActivationLinkViewMixin):
email_template_name = 'user_activation'
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class PasswordResetView(PasswordResetViewMixin):
site = 'dcl'
template_name = 'hosting/reset_password.html'
@ -326,6 +331,7 @@ class PasswordResetView(PasswordResetViewMixin):
template_email_path = 'hosting/emails/'
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class PasswordResetConfirmView(PasswordResetConfirmViewMixin):
template_name = 'hosting/confirm_reset_password.html'
success_url = reverse_lazy('hosting:login')
@ -402,6 +408,7 @@ class MarkAsReadNotificationView(LoginRequiredMixin, UpdateView):
return HttpResponseRedirect(reverse('hosting:notifications'))
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class SSHKeyDeleteView(LoginRequiredMixin, DeleteView):
login_url = reverse_lazy('hosting:login')
success_url = reverse_lazy('hosting:ssh_keys')
@ -430,6 +437,7 @@ class SSHKeyDeleteView(LoginRequiredMixin, DeleteView):
return super(SSHKeyDeleteView, self).delete(request, *args, **kwargs)
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class SSHKeyListView(LoginRequiredMixin, ListView):
template_name = "hosting/user_keys.html"
login_url = reverse_lazy('hosting:login')
@ -450,6 +458,7 @@ class SSHKeyListView(LoginRequiredMixin, ListView):
**response_kwargs)
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class SSHKeyChoiceView(LoginRequiredMixin, View):
template_name = "hosting/choice_ssh_keys.html"
login_url = reverse_lazy('hosting:login')
@ -476,6 +485,7 @@ class SSHKeyChoiceView(LoginRequiredMixin, View):
return redirect(reverse_lazy('hosting:ssh_keys'), foo='bar')
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class SSHKeyCreateView(LoginRequiredMixin, FormView):
form_class = UserHostingKeyForm
model = UserHostingKey
@ -538,6 +548,7 @@ class SSHKeyCreateView(LoginRequiredMixin, FormView):
return self.form_invalid(form)
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class SettingsView(LoginRequiredMixin, FormView):
template_name = "hosting/settings.html"
login_url = reverse_lazy('hosting:login')
@ -589,6 +600,7 @@ class SettingsView(LoginRequiredMixin, FormView):
return self.form_invalid(form)
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class PaymentVMView(LoginRequiredMixin, FormView):
template_name = 'hosting/payment.html'
login_url = reverse_lazy('hosting:login')
@ -667,8 +679,8 @@ class PaymentVMView(LoginRequiredMixin, FormView):
return self.form_invalid(form)
class OrdersHostingDetailView(LoginRequiredMixin,
DetailView):
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class OrdersHostingDetailView(LoginRequiredMixin, DetailView):
template_name = "hosting/order_detail.html"
context_object_name = "order"
login_url = reverse_lazy('hosting:login')
@ -881,6 +893,7 @@ class OrdersHostingDetailView(LoginRequiredMixin,
content_type="application/json")
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class OrdersHostingListView(LoginRequiredMixin, ListView):
template_name = "hosting/orders.html"
login_url = reverse_lazy('hosting:login')
@ -895,6 +908,7 @@ class OrdersHostingListView(LoginRequiredMixin, ListView):
return super(OrdersHostingListView, self).get_queryset()
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class OrdersHostingDeleteView(LoginRequiredMixin, DeleteView):
login_url = reverse_lazy('hosting:login')
success_url = reverse_lazy('hosting:orders')
@ -939,6 +953,7 @@ class VirtualMachinesPlanListView(LoginRequiredMixin, ListView):
return context
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class CreateVirtualMachinesView(LoginRequiredMixin, View):
template_name = "hosting/create_virtual_machine.html"
login_url = reverse_lazy('hosting:login')
@ -1011,6 +1026,7 @@ class CreateVirtualMachinesView(LoginRequiredMixin, View):
return redirect(reverse('hosting:payment'))
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
class VirtualMachineView(LoginRequiredMixin, View):
template_name = "hosting/virtual_machine_detail.html"
login_url = reverse_lazy('hosting:login')