Skip to content

Commit

Permalink
Merge pull request #478 from artoonie/vary-on-increment
Browse files Browse the repository at this point in the history
cache header vary on increment
  • Loading branch information
artoonie authored Aug 7, 2023
2 parents eca696e + dd9ba0b commit 027bb95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['../../static/']

master_doc = 'index'
7 changes: 1 addition & 6 deletions docs/source/contents.rst → docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.. rcvis documentation main file, created by
sphinx-quickstart on Sat May 23 19:06:58 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Ranked Choice Voting Visualizer
===============================

Expand All @@ -20,7 +15,7 @@ Modules
graph
api
common

descriptors


Indices and tables
Expand Down
4 changes: 4 additions & 0 deletions visualizer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from django.utils.decorators import method_decorator
from django.views import View
from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.decorators.vary import vary_on_headers
from django.views.generic.base import TemplateView, RedirectView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
Expand Down Expand Up @@ -147,6 +148,7 @@ def _actions_before_save(self, form):
self.model.jsonFile.save('datatablesfile.json', form.cleaned_data['jsonFile'])


@method_decorator(vary_on_headers('increment',), name='get')
class Visualize(DetailView):
""" Visualizing a single JsonConfig """
model = JsonConfig
Expand Down Expand Up @@ -185,6 +187,7 @@ def get_context_data(self, **kwargs):
return data


@method_decorator(vary_on_headers('increment',), name='get')
@method_decorator(xframe_options_exempt, name='dispatch')
class VisualizeEmbedded(DetailView):
"""
Expand Down Expand Up @@ -244,6 +247,7 @@ def get_redirect_url(self, *args, **kwargs):
return super().get_redirect_url(slug) + "?vistype=" + vistype


@method_decorator(vary_on_headers('increment',), name='get')
@method_decorator(xframe_options_exempt, name='dispatch')
class VisualizeBallotpedia(DetailView):
""" The embedded ballotpedia visualization """
Expand Down

0 comments on commit 027bb95

Please sign in to comment.