1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

move caching to views

This commit is contained in:
John Anderson
2019-04-15 14:41:04 -04:00
parent cdff29c7d5
commit 4723ddb5ce
21 changed files with 256 additions and 224 deletions

View File

@@ -17,6 +17,8 @@ from django.urls import reverse
from django.utils.html import escape
from django.utils.http import is_safe_url
from django.utils.safestring import mark_safe
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import requires_csrf_token
from django.views.defaults import ERROR_500_TEMPLATE_NAME
from django.views.generic import View
@@ -106,6 +108,7 @@ class ObjectListView(View):
return csv_data
@method_decorator(cache_page(settings.CACHE_TIMEOUT))
def get(self, request):
model = self.queryset.model
@@ -713,6 +716,7 @@ class ComponentCreateView(View):
model_form = None
template_name = None
@method_decorator(cache_page(settings.CACHE_TIMEOUT))
def get(self, request, pk):
parent = get_object_or_404(self.parent_model, pk=pk)