コード例 #1
0
ファイル: views.py プロジェクト: akaariai/django-haystack
 def test_initial_data(self):
     sv = SearchView(form_class=InitialedSearchForm)
     sv.request = HttpRequest()
     form = sv.build_form()
     self.assert_(isinstance(form, InitialedSearchForm))
     self.assertEqual(form.fields['q'].initial, 'Search for...')
     self.assertEqual(form.as_p(), u'<p><label for="id_q">Search:</label> <input type="text" name="q" value="Search for..." id="id_q" /></p>')
コード例 #2
0
ファイル: test_views.py プロジェクト: Koed00/django-haystack
 def test_initial_data(self):
     sv = SearchView(form_class=InitialedSearchForm)
     sv.request = HttpRequest()
     form = sv.build_form()
     self.assertTrue(isinstance(form, InitialedSearchForm))
     self.assertEqual(form.fields['q'].initial, 'Search for...')
     para = form.as_p()
     self.assertTrue(u'<label for="id_q">Search:</label>' in para)
     self.assertTrue(u'value="Search for..."' in para)
コード例 #3
0
ファイル: test_views.py プロジェクト: Koed00/django-haystack
    def test_spelling(self):
        # Stow.
        from django.conf import settings
        old = settings.HAYSTACK_CONNECTIONS['default'].get('INCLUDE_SPELLING', None)

        sv = SearchView()
        sv.query = 'Nothing'
        sv.results = []
        sv.build_page = lambda: (None, None)
        output = sv.create_response()

        # Restore
        settings.HAYSTACK_CONNECTIONS['default']['INCLUDE_SPELLING'] = old

        if old is None:
            del settings.HAYSTACK_CONNECTIONS['default']['INCLUDE_SPELLING']
コード例 #4
0
ファイル: test_views.py プロジェクト: acdha/django-haystack
    def test_spelling(self):
        # Stow.
        from django.conf import settings

        old = settings.HAYSTACK_CONNECTIONS["default"].get("INCLUDE_SPELLING", None)

        settings.HAYSTACK_CONNECTIONS["default"]["INCLUDE_SPELLING"] = True

        sv = SearchView()
        sv.query = "Nothing"
        sv.results = []
        sv.build_page = lambda: (None, None)
        sv.create_response()
        context = sv.get_context()

        self.assertIn(
            "suggestion",
            context,
            msg="Spelling suggestions should be present even if"
            " no results were returned",
        )
        self.assertEqual(context["suggestion"], None)

        # Restore
        settings.HAYSTACK_CONNECTIONS["default"]["INCLUDE_SPELLING"] = old

        if old is None:
            del settings.HAYSTACK_CONNECTIONS["default"]["INCLUDE_SPELLING"]
コード例 #5
0
ファイル: views.py プロジェクト: kamni/django-sphinxdoc
 def __call__(self, request, slug):
     self.slug = slug
     try:
         return SearchView.__call__(self, request)
     except PermissionDenied:
         if request.user.is_authenticated():
             raise
         path = request.build_absolute_uri()
         return redirect_to_login(path)
コード例 #6
0
    def test_spelling(self):
        # Stow.
        from django.conf import settings
        old = settings.HAYSTACK_CONNECTIONS['default'].get('INCLUDE_SPELLING', None)

        settings.HAYSTACK_CONNECTIONS['default']['INCLUDE_SPELLING'] = True

        sv = SearchView()
        sv.query = 'Nothing'
        sv.results = []
        sv.build_page = lambda: (None, None)
        sv.create_response()
        context = sv.get_context()

        self.assertIn('suggestion', context,
                      msg='Spelling suggestions should be present even if'
                          ' no results were returned')
        self.assertEqual(context['suggestion'], None)

        # Restore
        settings.HAYSTACK_CONNECTIONS['default']['INCLUDE_SPELLING'] = old

        if old is None:
            del settings.HAYSTACK_CONNECTIONS['default']['INCLUDE_SPELLING']
コード例 #7
0
ファイル: views.py プロジェクト: akaariai/django-haystack
 def test_empty_results(self):
     sv = SearchView()
     self.assert_(isinstance(sv.get_results(), EmptySearchQuerySet))
コード例 #8
0
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.shortcuts import redirect
from django.urls import reverse, path
from haystack.views import SearchView

from .forms.search import SearchForm
from .views.autocomplete import autocomplete
from .views.db_backups import download_database, upload_database, download_media

misc_urlpatterns=[
	path(r'admin/', admin.site.urls),
	path(r'admin/backup/media', download_media, name='backup_media'),
	path(r'admin/backup/db', download_database, name='backup_db'),
	path(r'admin/backup', lambda request: redirect(reverse('backup_db')), name='backup'),
	path(r'admin/restore', upload_database, name='restore'),
	path(r'search', SearchView(template='search_page.html', form_class=SearchForm), name='search'),
	path(r'autocomplete', autocomplete, name='autocomplete'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


コード例 #9
0
ファイル: test_views.py プロジェクト: Koed00/django-haystack
 def test_empty_results(self):
     sv = SearchView()
     sv.request = HttpRequest()
     sv.form = sv.build_form()
     self.assertTrue(isinstance(sv.get_results(), EmptySearchQuerySet))
コード例 #10
0
from anarapp.forms import BasicForm, AdvancedForm, PiedraForm
from haystack.query import SearchQuerySet
from anarapp import views
from django.views.generic import TemplateView, DetailView
from anarapp.models import Yacimiento, Piedra

yacimiento = SearchQuerySet().models(Yacimiento)
piedra = SearchQuerySet().models(Piedra)

urlpatterns = patterns(
    '',
    # url(r'^$', views.index, name='index'),
    # url(r'^results/$', views.results, name='results'),
    url(
        r'^$',
        SearchView(form_class=BasicForm, template='anarapp/index.html'),
    ),
    url(
        r'^quienes/',
        TemplateView.as_view(template_name="anarapp/quienes.html"),
    ),
    url(r'^results/',
        SearchView(template='anarapp/results.html',
                   searchqueryset=SearchQuerySet(),
                   form_class=AdvancedForm,
                   results_per_page=10),
        name='results'),
    url(
        r'^advanced/$',
        SearchView(searchqueryset=SearchQuerySet(),
                   form_class=AdvancedForm,
コード例 #11
0
ファイル: urls.py プロジェクト: patrick8link/sns-project
from django.urls import path

from . import views
from haystack.views import SearchView

app_name = 'search'
urlpatterns = [
    path('<search_id>/', views.search_id, name='search_id'),
    path('', SearchView(), name="haystack_search"),
]
コード例 #12
0
ファイル: urls.py プロジェクト: look4j/django_demo
"""django_example 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, include
from haystack.views import SearchView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('blog.urls')),
    path('search/', SearchView())
]
コード例 #13
0
ファイル: search.py プロジェクト: kuliye/ssmusic-django
from django.urls import path, re_path
from haystack.views import SearchView

urlpatterns = [
    path('', SearchView()),
]
コード例 #14
0
	def create_response(self):
		(paginator, page) = self.build_page()
		context = {
			'query': self.query,
			'form': self.form,
			'page': page,
			'suggestion': None,
			'paginator': paginator,
			'results': self.results
		}

"""


class SearchView(TemplateView):
    template_name = 'articles/search.html'


search_view = SearchView.as_view()


class FacetedSearchView(BaseFacetedSearchView):
    form_class = FacetedSearchForm
    facet_fields = ['article_subject', 'journal_title', 'keywords']
    paginate_by = 10
    context_object_name = 'object_list'
    template_name = 'articles/search.html'


faceted_search_view = FacetedSearchView.as_view()
コード例 #15
0
         name='locality_detail'),
    path('stops/<pk>.json', views.stop_json),
    path('stops/<pk>.xml', views.stop_xml),
    path('stops/<pk>.txt', views.stop_gtfs),
    path('stops/<pk>',
         views.StopPointDetailView.as_view(),
         name='stoppoint_detail'),
    url(r'^operators/(?P<pk>[A-Z]+)$', views.OperatorDetailView.as_view()),
    path('operators/<slug>',
         views.OperatorDetailView.as_view(),
         name='operator_detail'),
    path('services/<pk>.json', views.service_map_data),
    path('services/<pk>.xml', views.service_xml),
    path('services/<slug>',
         views.ServiceDetailView.as_view(),
         name='service_detail'),
    path('sitemap.xml', index, {'sitemaps': sitemaps}),
    path('sitemap-<section>.xml',
         sitemap, {'sitemaps': sitemaps},
         name='django.contrib.sitemaps.views.sitemap'),
    path('search', SearchView(form_class=CustomSearchForm)),
    path('journey', views.journey),
] + bustimes_views + vehicles_urls + vosa_urls

if settings.DEBUG and hasattr(staticfiles, 'views'):
    import debug_toolbar

    urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls))] + (
        static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +
        static.static('/', document_root=settings.STATIC_ROOT))
コード例 #16
0
 def __call__(self, request, slug):
     self.slug = slug
     return SearchView.__call__(self, request)
コード例 #17
0
from django.urls import path

from search import forms
from haystack.views import SearchView

app_name = 'search'
urlpatterns = [
    path('', SearchView(form_class=forms.SearchForm), name='search'),
]
コード例 #18
0
 def __init__(self):
     SearchView.__init__(self,
                         form_class=ProjectSearchForm,
                         template='sphinxdoc/search.html')
コード例 #19
0
from django.conf.urls.defaults import *
from haystack.views import SearchView
from haystack.forms import HighlightedModelSearchForm

urlpatterns = patterns(
    'haystack.views',
    url(r'^$',
        SearchView(form_class=HighlightedModelSearchForm),
        name='haystack_search'),
)
コード例 #20
0
 def __call__(self, request):
     language = get_language_from_request(request)
     self.searchqueryset = SearchQuerySet().filter(language=language)
     return BaseView.__call__(self, request)
コード例 #21
0
ファイル: urls.py プロジェクト: pbanaszkiewicz/ganeti_webmgr
urlpatterns += patterns(
    'ganeti_web.views.jobs',
    url(r'^%s/status/?' % job, 'status', name='job-status'),
    url(r'^%s/clear/?' % job, 'clear', name='job-clear'),
    url(r'^%s/?' % job, JobDetailView.as_view(), name='job-detail'),
)

# Search
urlpatterns += patterns(
    'ganeti_web.views.search',
    url(r'^search/suggestions.json', 'suggestions', name='search-suggestions'),
    url(r'^search/detail_lookup', 'detail_lookup',
        name='search-detail-lookup'))
urlpatterns += patterns(
    'ganeti_web.views.user_search',
    url(r'^search/owners/?$', 'search_owners', name="owner-search"))
urlpatterns += patterns(
    'haystack.views',
    url(r'^search/',
        login_required(SearchView(form_class=autocomplete_search_form)),
        name='search'))

#The following is used to serve up local static files like images
root = '%s/static' % os.path.dirname(os.path.realpath(__file__))
urlpatterns += patterns(
    '',
    (r'^static/(?P<path>.*)', 'django.views.static.serve', {
        'document_root': root,
    }),
)
コード例 #22
0
media_root = getattr(settings, 'MEDIA_ROOT', '/')

sitemaps = {
    'elections': ElectionsSitemap,
    'candidates': CandidatesSitemap,
}

urlpatterns = patterns(
    '',
    url(r'^$',
        cache_page(60 * settings.CACHE_MINUTES)(xframe_options_exempt(
            HomeView.as_view(template_name='elections/home.html'))),
        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(
コード例 #23
0
# encoding: utf-8
from django.conf.urls import url

from haystack.views import SearchView

urlpatterns = [url(r"^$", SearchView(), name="haystack_search")]
コード例 #24
0
ファイル: urls.py プロジェクト: Abalmaz/Library
        template_name='registration/pass_reset.html',
        email_template_name='registration/pass_reset_email.html',
        subject_template_name='registration/pass_reset_subject.txt'),
        name='password_reset'),
    path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(
        template_name='registration/pass_reset_done.html'),
        name='password_reset_done'),
    path('password_reset/<uidb64>/<token>/',
         auth_views.PasswordResetConfirmView.as_view(
             template_name='registration/pass_reset_confirm.html'),
         name='password_reset_confirm'),
    path('password_reset/complete/',
         auth_views.PasswordResetCompleteView.as_view(
             template_name='registration/pass_reset_complete.html'),
         name='password_reset_complete'),
    path('password/change_password/', auth_views.PasswordChangeView.as_view(
        template_name='registration/pass_change.html'),
        name='password_change'),
    path('password/change_password/done/',
         auth_views.PasswordChangeDoneView.as_view(
             template_name='registration/pass_change_done.html'),
         name='password_change_done'),
    path('invitation/<uuid:token>', views.invitation, name='invitation'),
    path('profile/', views.UserUpdateView.as_view(), name='profile'),
    path('profile/books/', views.BookCreateView.as_view(), name='book_add'),
    path('profile/books/<int:pk>/delete/', views.BookDeleteView.as_view(),
         name='book_delete'),
    path('search/', SearchView(form_class=HighlightedModelSearchForm),
         name='search'),
]
コード例 #25
0
"""Blog URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/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.conf.urls import url, include
from haystack.views import SearchView

urlpatterns = [
    path('admin/', admin.site.urls),
    url('MyBlog/', include('MyBlog.urls', namespace='MyBlog')),
    url('MyBlog/', include('comment.urls', namespace='comment')),
    url('search/', SearchView(), name='search'),
]
コード例 #26
0
ファイル: urls.py プロジェクト: mverleg/mu3
from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.views.i18n import set_language
from django.contrib import admin
from haystack.views import SearchView
from misc.views.notification import notification
import smuggler.urls, statix.urls
import account.urls

admin.autodiscover()

#urlpatterns = patterns('',
urlpatterns = i18n_patterns(
    '',
    #url(r'^$', home, name = 'home'),
    url(r'^account/', include(account.urls)),
    url(r'^admin/', include(smuggler.urls)),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^search/', SearchView(template='search.html'), name='search'),
    url(r'^lang/set/', set_language, name='set_language'),
    url(r'^$',
        notification, {
            'subject': 'Welcome',
            'message':
            'This is the default home page. More will probably appear soon!',
            'home_button': False
        },
        name='home'),
    url(r'^', include(statix.urls)),
)
コード例 #27
0
ファイル: urls.py プロジェクト: Chaowenqiang/python1903
from django.conf.urls import url
from . import views
from .feed import ArticleFeed
from haystack.views import SearchView

app_name = 'blog'
urlpatterns = [
    # url(r'^$', views.IndexView.as_view(), name='index'),
    url(r'^$', views.index_view, name='index'),
    url(r'^single/(\d+)/$', views.SingleView.as_view(), name='single'),
    url(r'^archive/(\d+)/(\d+)/$', views.ArchiveView.as_view(),
        name='archive'),
    url(r'^category/(\d+)/$', views.CategoryView.as_view(), name='category'),
    url(r'^tag/(\d+)/$', views.TagView.as_view(), name='tag'),
    url(r'^rss/$', ArticleFeed(), name='rss'),
    url(r'^about/$', views.AboutView.as_view(), name='about'),
    url(r'^contact/$', views.ContactView.as_view(), name='contact'),
    url(r'^search/$', SearchView(), name='search'),
]
コード例 #28
0
from pombola.core import models as core_models

from .views import SearchBaseView, GeocoderView

urlpatterns = patterns(
    'pombola.search.views',

    # Haystack and other searches
    url(r'^autocomplete/', 'autocomplete', name="autocomplete"),
    url(r'^$', SearchBaseView.as_view(), name='core_search'),

    # Location search
    url(r'^location/$', GeocoderView.as_view(), name='core_geocoder_search'),
)

# Hansard search - only loaded if hansard is enabled
if settings.ENABLED_FEATURES['hansard']:
    from pombola.hansard import models as hansard_models
    urlpatterns += patterns(
        'pombola.search.views',
        url(
            r'^hansard/$',
            SearchView(
                searchqueryset=SearchQuerySet().models(hansard_models.Entry, ),
                form_class=SearchForm,
                template="search/hansard.html",
            ),
            name='hansard_search',
        ),
    )
コード例 #29
0
 url(r'^proteinreuse/(?P<submission_id>[0-9]+)/(?:[0-9]+/)?$',
     views.PROTEINreuseview,
     name='proteinreuse'),
 #    url(r'^moleculereuse/(?P<submission_id>[0-9]+)/(?P<model_id>[0-9]+)/$', views.SMALL_MOLECULEreuseview, name='moleculereuse'),
 #    url(r'^modelrow/$', views.MODELrowview, name='modelrow'),
 url(r'^modelreuserequest/(?P<model_id>[0-9]+)/$',
     views.MODELreuseREQUESTview,
     name='modelreuserequest'),
 url(r'^MODELfilled/(?P<submission_id>[0-9]+)/$',
     views.MODELview,
     name='MODELfilled'),
 #url(r'^ajax_pdbchecker/(?P<submission_id>[0-9]+)/$', views.pdbcheck, name='pdbcheck'),
 url(r'^search/$',
     SearchView(
         template=
         '/protwis/sites/protwis/dynadb/templates/search/search.html',
         searchqueryset=sqs,
         form_class=MainSearchForm),
     name='haystack_search'),
 url(r'^ajaxsearch/', views.ajaxsearcher, name='ajaxsearcher'),
 url(r'^empty_search/', views.emptysearcher, name='emptysearcher'),
 url(r'^autocomplete/', views.autocomplete, name='autocomplete'),
 url(r'^advanced_search/$', views.NiceSearcher, name='NiceSearcher'),
 #url(r'^search_top/(?P<submission_id>[0-9]+)/$',views.search_top,name='search_top'),
 url(r'^dynamics/(?P<submission_id>[0-9]+)/$',
     views.DYNAMICSview,
     name='dynamics'),
 url(r'^dynamics/(?P<submission_id>[0-9]+)/(?:[0-9]+/)?upload_files/((?P<trajectory>traj)/)?$',
     views.upload_dynamics_files,
     name='dynamics_upload_files'),
 url(r'^dynamicsreuse/(?P<submission_id>[0-9]+)/(?:[0-9]+/)?upload_files/((?P<trajectory>traj)/)?$',
コード例 #30
0
ファイル: views.py プロジェクト: indexofire/gork
 def __init__(self):
     SearchView.__init__(self, form_class=ProjectSearchForm, template='docs/search.html')
コード例 #31
0
 def test_empty_results(self):
     sv = SearchView()
     sv.request = HttpRequest()
     sv.form = sv.build_form()
     self.assertTrue(isinstance(sv.get_results(), EmptySearchQuerySet))
コード例 #32
0
ファイル: urls.py プロジェクト: limumu008/django_blog
from django.urls import path
from django.views.decorators.cache import cache_page
from haystack.views import SearchView

from . import views

app_name = 'blog'
urlpatterns = [
    path('', cache_page(60)(views.IndexView.as_view()), name='index'),
    path(r'search/', SearchView(template='blog/search.html'), name='search'),
    path(r'archives/<int:year>/<int:month>/',
         views.ArchiveListView.as_view(), name='archives'),
    path(r'my_articles/', views.MyArticles.as_view(), name='my_articles'),
    path(r'my_articles/<slug:tag_slug>/', views.MyArticles.as_view(), name='my_articles_tags'),
    path(r'my_drafts/', views.MyDrafts.as_view(), name='my_drafts'),
    path(r'my_drafts/<slug:tag_slug>', views.MyDrafts.as_view(), name='my_drafts_tags'),
    path(r'article/<int:pk>/', views.article_detail, name='articles'),
    path(r'share_article/<int:id>/', views.share_article, name='share_article'),
    path(r'tags/<slug:tag_slug>/', views.IndexView.as_view(), name='tag_index'),
    path(r'tags/', views.retrieve_tags, name='tags'),
    path(r'article/new/', views.NewArticle.as_view(), name='new_article'),
    path(r'article/update/<int:pk>/', views.UpdateArticle.as_view(), name='update_article'),
    path(r'user_like/', views.user_like, name='user_like'),
    path(r'reply/', views.reply, name='reply'),
]
コード例 #33
0
from django.conf.urls import include, url
from django.contrib import admin
from haystack.views import SearchView
from haystack.forms import HighlightedSearchForm
from buginfo import api_views
from buginfo import views
urlpatterns = [
    # Examples:
    # url(r'^$', 'ecs.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'^$',
        SearchView(form_class=HighlightedSearchForm),
        name='haystack_search'),
    url(r'^buginfo/create/$', api_views.BugInfoView.as_view()),
    url(r'^bug_detail/(?P<pk>\d+)/$',
        views.BugDetailView.as_view(),
        name='bug_detail')
]
コード例 #34
0
ファイル: views.py プロジェクト: movermeyer/django-kb
from .settings import api_settings

__all__ = [
    'ArticleCreateView',
    'ArticleDeleteView',
    'ArticleDetailView',
    'ArticleListView',
    'ArticleUpdateView',
    'CategoryCreateView',
    'CategoryDeleteView',
    'CategoryDetailView',
    'CategoryListView',
    'CategoryUpdateView',
    'HomepageView',
    'SearchView',
    'TagListView',
]


class HomepageView(AddSearchFormToContextMixin, TemplateView):

    template_name = 'kb/index.html'

    def get_context_data(self, **kwargs):
        context = super(HomepageView, self).get_context_data(**kwargs)
        context['categories'] = Category.objects.categories()
        return context


SearchView = SearchView(form_class=api_settings.DEFAULT_SEARCH_FORM_CLASS)
コード例 #35
0
def MyForumSearchView(request):
    form = ModelSearchForm(request.GET) # A form bound to the GET data
    if form.is_valid(): # All validation rules pass
        sqs = SearchQuerySet().models(Post)
        search_view = SearchView(template = "forum/forum_search.html", searchqueryset=sqs)
        return search_view(request)
コード例 #36
0
try:
    from django.conf.urls import patterns, url
except ImportError:
    from django.conf.urls.defaults import patterns, url
from haystack.views import SearchView

urlpatterns = patterns(
    'haystack.views',
    url(r'^$', SearchView(), name='haystack_search'),
)
コード例 #37
0
from django.conf.urls import url
from . import views
from .feed import ArticleFeed
from haystack.views import SearchView

app_name = "blog"
urlpatterns = [
    # url(r'^$',views.IndexView.as_view(),name='index'),
    url(r'^$', views.index, name='index'),
    url(r'^single/(\d+)/$', views.SingleView.as_view(), name='single'),
    url(r'^archives/(\d+)/(\d+)/$',
        views.ArchivesView.as_view(),
        name='archives'),
    url(r'^category/(\d+)/$', views.CategoryView.as_view(), name='category'),
    url(r'^tags/(\d+)/$', views.TagView.as_view(), name='tags'),
    url(r'^rss/$', ArticleFeed(), name="rss"),
    url(r'^contact/$', views.ContactView.as_view(), name='contact'),
    # url(r'^search$',views)
    url(r'^search/$', SearchView(), name="search")
]
コード例 #38
0
ファイル: urls.py プロジェクト: geewid/eestecnet
    url(r'^teams', include('apps.teams.urls', namespace="teams",app_name="teams")),
    url(r'^events', include('apps.events.urls')),
    url(r'^people', include('apps.account.urls')),
    url(r'^materials', include('apps.elfinder.urls')),
    url(r'^news', include('apps.news.urls')),
    url(r'^wiki/', include('apps.wiki.urls')),
    url(r'^statistics', include('apps.statistics.urls')),  # not currently used
)
# Orphans
urlpatterns += patterns(
    '',
    url(r'^login/?', Login.as_view(), name='login'),
    url(r'^complete/(?P<ida>[-\w]+)/?$', complete, name='complete'),
    url(r'^logout/?', Logout.as_view(), name='logout'),
    url(r'^register/?', EestecerCreate.as_view(), name='register'),
    url(r'^search/', SearchView(form_class=SearchForm)),
    url(r'^activities/?$', ActivityStubs.as_view(), name='activities'),
    url(r'^sitemap/?$', ListView.as_view(model=Stub), name='sitemap'),
    url(r'^about/?$', AboutStubs.as_view(), name='about'),
    url(r'^get-involved/?$', GetinvolvedStubs.as_view(), name='getinvolved'),
    url(r'^newsletter/?$', newsletter, name='newsletter'),
    url(r'^active/?$', MassCommunication.as_view(), name='masscommunication'),
    url(r'^privileged/?$', PrivilegedCommunication.as_view(), name='privcommunication'),
    url(r'^governance/?$', Governance.as_view(), name='governance'),
    url(r'^careers/?$', CarreerList.as_view(), name='careers'),
    url(r'^careers/(?P<slug>[-\w]+)/?$', CarreerDetail.as_view(), name='careeroffer'),
)
# Redirects
urlpatterns += patterns(
    '',
    url(r'seminar/?', RedirectView.as_view(url="http://www.crowdcast.io/eestec1")),
コード例 #39
0
ファイル: views.py プロジェクト: indexofire/gork
 def __call__(self, request, slug):
     self.slug = slug
     return SearchView.__call__(self, request)
コード例 #40
0
 def test_view_suggestion(self):
     view = SearchView(template='test_suggestion.html')
     mock = HttpRequest()
     mock.GET['q'] = 'exampl'
     resp = view(mock)
     self.assertEqual(resp.content, b'Suggestion: example')