def test_paginate_by_param(self): request = self.get_request('/en-US/search') view = SearchView.as_view(paginate_by=1) response = view(request) eq_(response.data['pages'], 6) request = self.get_request('/en-US/search?per_page=4') response = view(request) eq_(response.data['pages'], 2)
def test_paginate_by_param(self): request = self.get_request("/en-US/search") view = SearchView.as_view(paginate_by=1) response = view(request) eq_(response.data["pages"], 6) request = self.get_request("/en-US/search?per_page=4") response = view(request) eq_(response.data["pages"], 2)
def test_paginate_by_param(self): request = self.get_request('/en-US/search') view = SearchView.as_view(paginate_by=1) response = view(request) eq_(response.data['pages'], 5) request = self.get_request('/en-US/search?per_page=4') response = view(request) eq_(response.data['pages'], 2)
def test_paginate_by_param(self): request = factory.get('/en-US/search') LocaleURLMiddleware().process_request(request) view = SearchView.as_view(paginate_by=1) response = view(request) eq_(response.data['pages'], 5) request = factory.get('/en-US/search?per_page=4') LocaleURLMiddleware().process_request(request) response = view(request) eq_(response.data['pages'], 2)
from django.urls import path from search.views import SearchView from .views import EventsListView urlpatterns = [ path('', EventsListView.as_view(), name='events'), path('search_results/', SearchView.as_view(), name='search') ]
from django.urls import path from search.views import SearchView urlpatterns = [ path('', SearchView.as_view()), ]
"""NovelSearch URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, re_path from search.views import IndexView, SearchView urlpatterns = [ path('admin/', admin.site.urls), re_path(r'^$', IndexView.as_view(), name='index'), re_path(r'^search$', SearchView.as_view(), name='search') ]
"""URLs for search""" from django.conf.urls import url from search.views import SearchView, RelatedPostsView, SimilarResourcesView urlpatterns = [ url(r"api/v0/search/", SearchView.as_view(), name="search"), url( r"api/v0/related/(?P<post_id>[A-Za-z0-9_]+)/$", RelatedPostsView.as_view(), name="related-posts", ), url(r"api/v0/similar/$", SimilarResourcesView.as_view(), name="similar-resources"), ]
def register_external_links_url(): return [ re_path(r'^external-links/$', SearchView.as_view(), name='external-links') ]
"""lcv_search URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from search.views import IndexView, SuggestView, SearchView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', IndexView.as_view(), name="index"), url(r'^suggest/$', SuggestView.as_view(), name="suggest"), url(r'^result/$', SearchView.as_view(), name="search"), ]
from django.conf.urls import url from search.views import BasicSearchAPIView, FullCompendiumView, SearchView urlpatterns = [ url(r"^$", SearchView.as_view(), name="search"), url(r"_all", FullCompendiumView.as_view()), url(r"_basic", BasicSearchAPIView.as_view()), ]
AboutAPIView, DataSourceView, ) sitemaps = { config.name: config.sitemap for config in apps.get_app_configs() if hasattr(config, "sitemap") } urlpatterns = [ path("", HomeView.as_view(), name="home"), path('about_search', AboutSearchView.as_view(), name="about_search"), path('api', AboutAPIView.as_view(), name="about_api"), path("search", SearchView.as_view(), name="search>results"), path("search/suggest", SuggestView.as_view(), name="search>suggest"), path("smida/", include("smida.urls")), path("smida_reports/", include("smida_reports.urls")), path("vkks/", include("vkks.urls")), path("cvk_2015/", include("cvk_2015.urls")), path("dabi_licenses/", include("dabi_licenses.urls")), path("dabi_registry/", include("dabi_registry.urls")), path("geoinf_licenses/", include("geoinf_licenses.urls")), path("mbu/", include("mbu.urls")), path("company_house_ua/", include("company_house_ua.urls")), path("tax_debts/", include("tax_debts.urls")), path("procurement_winners/", include("procurement_winners.urls")), path("lets_party/", include("lets_party.urls")), path("corrupt/", include("corrupt.urls")), path("tax_reg/", include("tax_reg.urls")),
def register_external_links_url(): return [ re_path(r"^external-links/$", SearchView.as_view(), name="external-links") ]
from django.conf.urls import include from search.views import SearchView, RecordView, ExportView, MoreLikeThisView, HomeView, DefaultView from ramp.views import RampView urlpatterns = [ path('search/admin/doc/', include('django.contrib.admindocs.urls')), path('search/admin/', admin.site.urls), ] if settings.SEARCH_LANG_USE_PATH: urlpatterns += [ path('', DefaultView.as_view(), name="HomePage"), path('search/', DefaultView.as_view(), name="HomePage"), path('search/<str:lang>/', HomeView.as_view(), name="HomePage"), path('search/<str:lang>/<str:search_type>/', SearchView.as_view(), name="SearchForm"), path('rechercher/<str:lang>/<str:search_type>/', SearchView.as_view(), name="SearchForm"), path('search/<str:lang>/<str:search_type>/record/<str:record_id>', RecordView.as_view(), name='RecordForm'), path('search/<str:lang>/<str:search_type>/export/', ExportView.as_view(), name='ExportForm'), path('search/<str:lang>/<str:search_type>/similar/<str:record_id>', MoreLikeThisView.as_view(), name='MLTForm'), path('search/<str:lang>/<str:search_type>/similaire/<str:record_id>', MoreLikeThisView.as_view(),
"""mtianyanSearch URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.views.generic import TemplateView from search.views import SearchSuggest, SearchView, IndexView,favicon_view urlpatterns = [ path('admin/', admin.site.urls), path('', IndexView.as_view(),name = "index"), path('suggest/',SearchSuggest.as_view(),name = "suggest"), path('search/', SearchView.as_view(), name="search"), path('favicon.ico', favicon_view), ]
1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from django.views.generic import TemplateView from search.views import SearchSuggest, SearchView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', TemplateView.as_view(), name="index"), url(r'^suggest/$', SearchSuggest.as_view(), name="suggest"), #处理搜索建议 #在\LcvSearch\src\search\views.py 内处理 url(r'^search/$', SearchView.as_view(), name="search"), # search 接口 #在\LcvSearch\src\search\views.py 内定义SearchView ] # LcvSearch\src\search\views.py import json from django.shortcuts import render from django.views.generic.base import View from search.models import ArticleType from django.http import HttpResponse from elasticsearch import Elasticsearch
from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.views.generic import RedirectView, TemplateView from search.views import SearchView urlpatterns = [ url(r'^grappelli/', include('grappelli.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^search/$', SearchView.as_view(), name='haystack_search'), url( r'^', include('profiles.urls', namespace='profile'), ), url('', include('social.apps.django_app.urls', namespace='social')), url(r'^favicon\.ico$', RedirectView.as_view(url=settings.STATIC_URL + 'img/favicon.png')), url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain'), name='robots'), url(r'^', include('tickets.urls')), ] handler404 = 'main.views.handle_404' handler500 = 'main.views.handle_500'
from django.urls import path from search.views import PackageDocumentDetailView, SearchView urlpatterns = [ path("", SearchView.as_view()), path("package/<id>/", PackageDocumentDetailView.as_view()), ]
url(r'^catalog/(?P<category_slug>[-\w]+)/(?P<slug>[-\w]+)/review/$', ensure_csrf_cookie(ProductReviewView.as_view()), name='product_review'), url(r'^news/$', NewsListView.as_view(), name='news_list'), url(r'^news/(?P<pk>[\d]+)/$', NewsDetailView.as_view(), name='news_detail'), url(r'^shop/login/$', LoginView.as_view(), name='shop_login'), url(r'^shop/logout/$', LogoutView.as_view(), name='shop_logout'), url(r'^shop/cart/$', CartView.as_view(), name='shop_cart'), url(r'^shop/customer/$', CustomerView.as_view(), {}, name='shop_customer'), url(r'^shop/order/$', OrderView.as_view(), name='shop_order'), url(r'^shop/orders/$', OrderListView.as_view(), name='shop_order_list'), url(r'^shop/order/(?P<pk>[\d]+)/$', OrderDetailView.as_view(), name='shop_order_detail'), url(r'^shop/order/(?P<pk>[\d]+)/liqpay-confirm/$', csrf_exempt(OrderLiqPayConfirmView.as_view()), name='shop_order_liqpay_confirm'), url(r'^shop/order/(?P<pk>[\d]+)/invoice\.pdf$', OrderInvoice.as_view(), name='shop_order_invoice'), url(r'^search/', SearchView.as_view(), name='search'), url(r'^admin/', include(admin.site.urls)), url(r'^(?P<slug>[-\w]+)/$', StaticPageView.as_view(), name='static_page'), ) # Media serve ONLY for dev server, in production this should be done by server if settings.DEBUG: from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns += staticfiles_urlpatterns() urlpatterns += patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), )
from django.conf.urls import patterns, url from django.conf import settings from django.contrib.staticfiles.urls import staticfiles_urlpatterns from transcripts.views import PageView, PhasesView, RangeView, ErrorView, OriginalView from homepage.views import HomepageView, HomepageQuoteView from search.views import SearchView from homepage.views import HomepageView, AboutView tspatt = r'-?\d+:\d+:\d+:\d+' urlpatterns = patterns('', url(r'^$', HomepageView.as_view(), name="homepage"), url(r'^homepage-quote/$', HomepageQuoteView.as_view()), url(r'^about/$', AboutView.as_view(), name="about"), url(r'^page/(?:(?P<transcript>[-_\w]+)/)?$', PageView.as_view(), name="view_page"), url(r'^page/(?P<start>' + tspatt + ')/(?:(?P<transcript>[-_\w]+)/)?$', PageView.as_view(), name="view_page"), url(r'^(?P<start>' + tspatt + ')/(?:(?P<transcript>[-_\w]+)/)?$', RangeView.as_view(), name="view_range"), url(r'^stream/(?P<start>' + tspatt + ')/?$', 'transcripts.views.stream', name="stream"), url(r'^(?P<start>' + tspatt + ')/(?P<end>' + tspatt + ')/(?:(?P<transcript>[-_\w]+)/)?$', RangeView.as_view(), name="view_range"), url(r'^phases/$', PhasesView.as_view(), name="phases"), url(r'^phases/(?P<phase_number>\d+)/$', PhasesView.as_view(), name="phases"), url(r'^search/$', SearchView.as_view(), name="search"), url(r'^people/$', 'people.views.people', name="people"), url(r'^people/(?P<role>[-_\w]+)/$', 'people.views.people', name="people"), url(r'^glossary/$', 'glossary.views.glossary', name="glossary"), url(r'^original/(?:(?P<transcript>[-_\w]+)/)?(?P<page>-?\d+)/$', OriginalView.as_view(), name="original"), ) urlpatterns += staticfiles_urlpatterns()
"""SuperSearch URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from django.views.generic import TemplateView from search.views import SearchSuggest, SearchView, IndexView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', IndexView.as_view(), name="index"), url(r'^suggest/$', SearchSuggest.as_view(), name="suggest"), url(r'^search/$', SearchView.as_view(), name="search"), ]
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from destination.views import DestinationDetailView from search.views import HomeView, SearchView urlpatterns = [ path('', HomeView.as_view(), name='home'), path('destinations/<int:pk>/', DestinationDetailView.as_view(), name='destination-detail'), path('search/', SearchView.as_view(), name='search'), path('accounts/', include('allauth.urls')), path('admin/', admin.site.urls), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# search/urls.py from django.urls import path #, include from django.conf.urls import url from search.views import ( SearchView, FeatureContextView, TraceGeomView ) #app_name = "search" urlpatterns = [ path('index/', SearchView.as_view(), name='search'), # home page search path('context/', FeatureContextView.as_view(), name='feature_context'), # place portal context path('tracegeom/', TraceGeomView.as_view(), name='trace_geom'), # trace features <- search & place portal ]
https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.urls import path, re_path from django.views.static import serve from search.views import IndexView, SearchSuggest, SearchView, favicon_view from user.views import LoginView, LogoutView, RegisterView urlpatterns = [ path('favicon.ico', favicon_view), re_path('media/(?P<path>.*)', serve, {"document_root": settings.MEDIA_ROOT}), path('', IndexView.as_view(), name="index"), path('suggest/', SearchSuggest.as_view(), name="suggest"), path('search/', SearchView.as_view(), name="search"), path('login/', LoginView.as_view(), name="login"), path('logout/', LogoutView.as_view(), name="logout"), path("register/", RegisterView.as_view(), name="register"), ]
from homepage.views import HomepageView, AboutView tspatt = r"-?\d+:\d+:\d+:\d+" urlpatterns = patterns( "", url(r"^$", HomepageView.as_view(), name="homepage"), url(r"^homepage-quote/$", HomepageQuoteView.as_view()), url(r"^about/$", AboutView.as_view(), name="about"), url(r"^page/$", PageView.as_view(), name="view_page"), url(r"^page/(?P<start>" + tspatt + ")/$", PageView.as_view(), name="view_page"), url(r"^(?P<start>" + tspatt + ")/$", RangeView.as_view(), name="view_range"), url(r"^(?P<start>" + tspatt + ")/(?P<end>" + tspatt + ")/$", RangeView.as_view(), name="view_range"), url(r"^phases/$", PhasesView.as_view(), name="phases"), url(r"^phases/(?P<phase_number>\d+)/$", PhasesView.as_view(), name="phases"), url(r"^search/$", SearchView.as_view(), name="search"), url(r"^people/$", "people.views.people", name="people"), url(r"^people/(?P<role>[-_\w]+)/$", "people.views.people", name="people"), url(r"^glossary/$", "glossary.views.glossary", name="glossary"), url(r"^original/(?P<page>-?\d+)/$", OriginalView.as_view(), name="original"), ) if settings.DEBUG: # pragma: no cover urlpatterns += patterns( "", ( r"^" + settings.MISSIONS_STATIC_URL[1:] + "(?P<path>.*)$", "django.views.static.serve", {"document_root": settings.MISSIONS_STATIC_ROOT}, ), (
"""ChihiroSearch URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.views.generic import TemplateView from search.views import SearchSuggest, SearchView urlpatterns = [ path('admin/', admin.site.urls), path('', TemplateView.as_view(template_name="index.html")), path("suggest", SearchSuggest.as_view(), name="suggest"), path("search", SearchView.as_view(), name="search"), ]
def register_external_links_url(): return [url( r'^external-links/$', SearchView.as_view(), name='external-links' )]
"""elastic URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from search.views import IndexView, SearchView from elastic.views import Index urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^index/$', IndexView.as_view(), name='index'), url(r'^search/$', SearchView.as_view(), name='search'), url(r'^$', Index.as_view()) ]
TemplateView.as_view(template_name="search.html"), name="recherche", ), path( "deposer-une-annonce/", AdPostView.as_view(template_name='deposer-une-annonce.html'), name="deposer-une-annonce", ), path( "delete_ad/<pk>", DeleteAdView.as_view(), name="supprimer", ), path( "search/", SearchView.as_view(template_name="search.html"), name="search", ), path( "ad/<pk>", DetailAdView.as_view(template_name="ad.html"), name="ad", ), path("send-message/<pk>", SendMessageView.as_view(template_name="send-message.html"), name="send-message"), path("merci/", TemplateView.as_view(template_name="merci-contact.html"), name="merci"), path("mentions-legales/", TemplateView.as_view(template_name="mentions-legales.html"),