def test_tags_search_view_params(self): view = ElectionsSearchByTagView() self.assertIsInstance(view, FormView) self.assertEquals(view.get_success_url(), reverse('tags_search')) self.assertEquals(view.form_class, ElectionSearchByTagsForm) self.assertEquals(view.template_name, 'search/tags_search.html')
new_answer_endpoint = r"^new_answer/%s/?$" % (settings.NEW_ANSWER_ENDPOINT) sitemaps = { 'elections': ElectionsSitemap, 'candidates': CandidatesSitemap, } urlpatterns = patterns('', url(new_answer_endpoint,AnswerWebHook.as_view(), name='new_answer_endpoint' ), url(r'^/?$', cache_page(HomeView.as_view(template_name='elections/home.html'), 60 * settings.CACHE_MINUTES), name='home' ), url(r'^buscar/?$', SearchView( template='search.html', form_class=ElectionForm ), name='search' ), url(r'^busqueda_tags/?$', ElectionsSearchByTagView.as_view(), name='tags_search' ), url(r'^election/(?P<slug>[-\w]+)/?$', cache_page(ElectionDetailView.as_view(template_name='elections/election_detail.html'), 60 * settings.CACHE_MINUTES), name='election_view' ), url(r'^election/(?P<slug>[-\w]+)/questionary/?$', cache_page(ElectionDetailView.as_view(template_name='elections/election_questionary.html'), 60 * settings.CACHE_MINUTES), name='questionary_detail_view'), #compare two candidates url(r'^election/(?P<slug>[-\w]+)/face-to-face/(?P<slug_candidate_one>[-\w]+)/(?P<slug_candidate_two>[-\w]+)/?$', cache_page(FaceToFaceView.as_view(template_name='elections/compare_candidates.html'), 60 * settings.CACHE_MINUTES), name='face_to_face_two_candidates_detail_view'), #one candidate for compare url(r'^election/(?P<slug>[-\w]+)/face-to-face/(?P<slug_candidate_one>[-\w]+)/?$', cache_page(ElectionDetailView.as_view(template_name='elections/compare_candidates.html'), 60 * settings.CACHE_MINUTES), name='face_to_face_one_candidate_detail_view'), #no one candidate
from django.views.decorators.clickjacking import xframe_options_exempt from django.views.decorators.cache import cache_page media_root = getattr(settings, 'MEDIA_ROOT', '/') urlpatterns = [ path('', cache_page(60 * settings.CACHE_MINUTES)(xframe_options_exempt( HomeView.as_view())), name='home'), path('buscar', SearchView(template='search.html', form_class=ElectionForm), name='search'), path('busqueda_tags', ElectionsSearchByTagView.as_view(), name='tags_search'), path('eleccion/<slug:slug>', ElectionDetailView.as_view( template_name='elections/election_detail.html'), name='election_view'), path('eleccion/<slug:slug>/questionary', ElectionDetailView.as_view( template_name='elections/election_questionary.html'), name='questionary_detail_view'), # compare two candidates path( 'eleccion/<slug:slug>/face-to-face/<slug:slug_candidate_one>/<slug:slug_candidate_two>', FaceToFaceView.as_view( template_name='elections/compare_candidates.html'), name='face_to_face_two_candidates_detail_view'),
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.clickjacking import xframe_options_exempt from django.views.decorators.cache import cache_page media_root = getattr(settings, 'MEDIA_ROOT', '/') urlpatterns = [ url(r'^$', cache_page(60 * settings.CACHE_MINUTES)(xframe_options_exempt(HomeView.as_view())), name='home'), url(r'^buscar/?$', SearchView(template='search.html', form_class=ElectionForm), name='search'), url(r'^busqueda_tags/?$', ElectionsSearchByTagView.as_view(), name='tags_search'), url(r'^eleccion/(?P<slug>[-\w]+)/?$', cache_page(60 * settings.CACHE_MINUTES)(ElectionDetailView.as_view(template_name='elections/election_detail.html')), name='election_view'), url(r'^eleccion/(?P<slug>[-\w]+)/questionary/?$', cache_page(60 * settings.CACHE_MINUTES)(ElectionDetailView.as_view(template_name='elections/election_questionary.html')), name='questionary_detail_view'), #compare two candidates url(r'^eleccion/(?P<slug>[-\w]+)/face-to-face/(?P<slug_candidate_one>[-\w]+)/(?P<slug_candidate_two>[-\w]+)/?$', cache_page(60 * settings.CACHE_MINUTES)(FaceToFaceView.as_view(template_name='elections/compare_candidates.html')), name='face_to_face_two_candidates_detail_view'), #one candidate for compare url(r'^eleccion/(?P<slug>[-\w]+)/face-to-face/(?P<slug_candidate_one>[-\w]+)/?$', cache_page(60 * settings.CACHE_MINUTES)(ElectionDetailView.as_view(template_name='elections/compare_candidates.html')), name='face_to_face_one_candidate_detail_view'), #no one candidate