Ticket #15142: dont_cache_test_views.diff

File dont_cache_test_views.diff, 1.9 KB (added by jsdalton, 5 years ago)
  • django/contrib/auth/tests/urls.py

     
    44from django.contrib.auth.decorators import login_required
    55from django.http import HttpResponse
    66from django.template import Template, RequestContext
     7from django.views.decorators.cache import never_cache
    78
     9@never_cache
    810def remote_user_auth_view(request):
    911    "Dummy view for remote user tests"
    1012    t = Template("Username is {{ user }}.")
  • django/contrib/messages/tests/urls.py

     
    55from django.shortcuts import render_to_response, redirect
    66from django.template import RequestContext, Template
    77from django.template.response import TemplateResponse
     8from django.views.decorators.cache import never_cache
    89
    910TEMPLATE = """{% if messages %}
    1011<ul class="messages">
     
    1718{% endif %}
    1819"""
    1920
     21@never_cache
    2022def add(request, message_type):
    2123    # don't default to False here, because we want to test that it defaults
    2224    # to False if unspecified
     
    3133    show_url = reverse('django.contrib.messages.tests.urls.show')
    3234    return HttpResponseRedirect(show_url)
    3335
     36@never_cache
    3437def add_template_response(request, message_type):
    3538    for msg in request.POST.getlist('messages'):
    3639        getattr(messages, message_type)(request, msg)
     
    3841    show_url = reverse('django.contrib.messages.tests.urls.show_template_response')
    3942    return HttpResponseRedirect(show_url)
    4043
     44@never_cache
    4145def show(request):
    4246    t = Template(TEMPLATE)
    4347    return HttpResponse(t.render(RequestContext(request)))
    4448
     49@never_cache
    4550def show_template_response(request):
    4651    return TemplateResponse(request, Template(TEMPLATE))
    4752
Back to Top