Django allows generated pages to be cached by default by the browser. This can result in stale data displaying for some pages.
Instead, disable HTTP caching of ToasterTable responses, so that each time a ToasterTable view is displayed, its data is refreshed. This carries a performance penalty, but ensures that ToasterTable views (e.g. compatible layers) are correctly refreshed if the user navigates their history with forward/back. [YOCTO #7660] Signed-off-by: Elliot Smith <[email protected]> --- bitbake/lib/toaster/toastergui/widgets.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index eb2914d..52ca6be 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py @@ -20,6 +20,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from django.views.generic import View, TemplateView +from django.views.decorators.cache import cache_control from django.shortcuts import HttpResponse from django.http import HttpResponseBadRequest from django.core import serializers @@ -61,6 +62,10 @@ class ToasterTable(TemplateView): orderable=True, field_name="id") + # prevent HTTP caching of table data + @cache_control(must_revalidate=True, max_age=0, no_store=True, no_cache=True) + def dispatch(self, *args, **kwargs): + return super(ToasterTable, self).dispatch(*args, **kwargs) def get(self, request, *args, **kwargs): if request.GET.get('format', None) == 'json': -- Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- _______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster
