Esempio n. 1
0
    def test_list_selected_facets(self):
        fsv = FacetedSearchView()
        fsv.request = HttpRequest()
        fsv.request.GET = QueryDict('')
        fsv.form = fsv.build_form()
        self.assertEqual(fsv.form.selected_facets, [])

        fsv = FacetedSearchView()
        fsv.request = HttpRequest()
        fsv.request.GET = QueryDict('selected_facets=author:daniel&selected_facets=author:chris')
        fsv.form = fsv.build_form()
        self.assertEqual(fsv.form.selected_facets, [u'author:daniel', u'author:chris'])
Esempio n. 2
0
    def test_list_selected_facets(self):
        fsv = FacetedSearchView()
        fsv.request = HttpRequest()
        fsv.request.GET = QueryDict('')
        fsv.form = fsv.build_form()
        self.assertEqual(fsv.form.selected_facets, [])

        fsv = FacetedSearchView()
        fsv.request = HttpRequest()
        fsv.request.GET = QueryDict('selected_facets=author:daniel&selected_facets=author:chris')
        fsv.form = fsv.build_form()
        self.assertEqual(fsv.form.selected_facets, [u'author:daniel', u'author:chris'])
Esempio n. 3
0
 def test_empty_results(self):
     fsv = FacetedSearchView()
     fsv.request = HttpRequest()
     fsv.request.GET = QueryDict('')
     fsv.form = fsv.build_form()
     self.assertTrue(isinstance(fsv.get_results(), EmptySearchQuerySet))
Esempio n. 4
0
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet
from haystack.views import FacetedSearchView, SearchView, basic_search

admin.autodiscover()

urlpatterns = [
    path("", SearchView(load_all=False), name="haystack_search"),
    path("admin/", admin.site.urls),
    path("basic/",
         basic_search, {"load_all": False},
         name="haystack_basic_search"),
    path(
        "faceted/",
        FacetedSearchView(
            searchqueryset=SearchQuerySet().facet("author"),
            form_class=FacetedSearchForm,
        ),
        name="haystack_faceted_search",
    ),
]

urlpatterns += [
    path(
        "",
        include(("test_haystack.test_app_without_models.urls",
                 "app-without-models")),
    )
]
Esempio n. 5
0
    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
#
# urlpatterns = [
#     path('admin/', admin.site.urls),
# ]

from django.conf.urls import url, include
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet
from haystack.views import FacetedSearchView

urlpatterns = [
    url(r'^', include('games.urls')),
    url(r'^api-auth/', include('rest_framework.urls')),
    # url(r'^search/', include('haystack.urls')),
    url(r'^search/',
        FacetedSearchView(
            form_class=FacetedSearchForm,
            searchqueryset=SearchQuerySet().facet('game_category')),
        name='haystack_search'),
]
Esempio n. 6
0
 def test_default_form(self):
     fsv = FacetedSearchView()
     fsv.request = HttpRequest()
     fsv.request.GET = QueryDict('')
     fsv.form = fsv.build_form()
     self.assert_(isinstance(fsv.form, FacetedSearchForm))
Esempio n. 7
0
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet
from haystack.views import FacetedSearchView, SearchView

admin.autodiscover()

urlpatterns = patterns(
    '',
    (r'^admin/', include(admin.site.urls)),
)

urlpatterns += patterns(
    'haystack.views',
    url(r'^$', SearchView(load_all=False), name='haystack_search'),
    url(r'^faceted/$',
        FacetedSearchView(searchqueryset=SearchQuerySet().facet('author'),
                          form_class=FacetedSearchForm),
        name='haystack_faceted_search'),
    url(r'^basic/$',
        'basic_search', {'load_all': False},
        name='haystack_basic_search'),
)

urlpatterns += patterns(
    'app-without-models',
    url(
        r'',
        include('test_haystack.test_app_without_models.urls',
                namespace='app-without-models')),
)
Esempio n. 8
0
 def test_empty_results(self):
     fsv = FacetedSearchView()
     self.assert_(isinstance(fsv.get_results(), EmptySearchQuerySet))
Esempio n. 9
0
sqs = SearchQuerySet().facet('prop_19_exact')

urlpatterns = patterns(
    'base.views',
    url(r'^admin/base/file/add/', 'addfile', name='addfile'),
    url(r'^$', 'home', name='home'),
    url(r'^map/(?P<location_id>\d+)/$', 'mapdetail', name='mapdetail'),
    url(r'^about/ur-online-project', 'about', name='about'),
    url(r'^about/ancient-ur/', 'ancientur', name='ancientur'),
    url(r'^about/excavations/', 'excavations', name='excavations'),
    url(r'^about/woolleys-excavations/', 'woolley', name='woolley'),
    url(r'^about/cast-of-characters/', 'characters', name='characters'),
    url(r'^developers/', 'developers', name='developers'),
    url(r'^sample/', 'sample', name='sample'),
    url(r'^search/',
        FacetedSearchView(form_class=AdvModelSearchForm, searchqueryset=sqs),
        name='haystack_search'),
    # ex: /ur.iaas.upenn.edu/subject/5/
    url(r'^subject/(?P<subject_id>\d+)/$',
        'subjectdetail',
        name='subjectdetail'),
    # ex: /ur.iaas.upenn.edu/personorg/5/
    url(r'^personorg/(?P<personorg_id>\d+)/$',
        'personorgdetail',
        name='personorgdetail'),
    # ex: /ur.iaas.upenn.edu/media/5/
    url(r'^media_item/(?P<media_id>\d+)/$', 'mediadetail', name='mediadetail'),
    url(r'^property/(?P<prop_id>\d+)/$',
        'propertydetail',
        name='propertydetail'),
    url(r'^terminology/', 'terminology', name='terminology'),
Esempio n. 10
0
     'core.views.serve_docs',
     {'version_slug': None,
     'lang_slug': None},
     name='docs_detail'
 ),
 url(r'^docs/', include('projects.urls.public')),
 url(r'^docs-edit/', include('editor.urls')),
 url(r'^projects/', include('projects.urls.public')),
 url(r'^builds/', include('builds.urls')),
 url(r'^bookmarks/', include('bookmarks.urls')),
 url(r'^flagging/', include('basic.flagging.urls')),
 url(r'^views/', include('watching.urls')),
 url(r'^accounts/', include('registration.backends.default.urls')),
 url(r'^search/author/',
     FacetedSearchView(form_class=FacetedSearchForm,
                       searchqueryset=author_sqs,
                       template="search/faceted_author.html"),
     name='haystack_author'),
 url(r'^search/project/',
     FacetedSearchView(form_class=FacetedSearchForm,
                       searchqueryset=project_sqs,
                       template="search/faceted_project.html"),
     name='haystack_project'),
 url(r'^search/', include('haystack.urls')),
 url(r'^admin/', include(admin.site.urls)),
 url(r'^dashboard/bookmarks/',
     'bookmarks.views.user_bookmark_list',
     name='user_bookmarks'
 ),
 url(r'^dashboard/', include('projects.urls.private')),
 url(r'^github', 'core.views.github_build', name='github_build'),
Esempio n. 11
0
from loginurl.views import cleanup, login

from haystack.query import SearchQuerySet
from haystack.views import FacetedSearchView

from .views import IndexView, PersonDetailView, PersonCreateView, PersonUpdateView, \
 DirectoryFacetedSearchForm, LoginView

sqs = SearchQuerySet().facet('region').facet('general_expertise') \
  .facet('oer_expertise').facet('openacess_expertise').facet('mooc_expertise')

urlpatterns = patterns(
    '', url(r'^login/cleanup/$', cleanup, name='loginurl-cleanup'),
    url(r'^login/(?P<key>[0-9A-Za-z]+-[a-z0-9-]+)/$',
        login,
        name='loginurl-login'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^logout/$',
        'django.contrib.auth.views.logout', {'next_page': '/directory/'},
        name='logout'),
    url(r'^search/$',
        FacetedSearchView(form_class=DirectoryFacetedSearchForm,
                          searchqueryset=sqs),
        name='haystack_search'),
    url(r'^professional/(?P<slug>[\w-]+)/',
        PersonDetailView.as_view(),
        name="person-detail"),
    url(r'^add/$', PersonCreateView.as_view(), name="person-create"),
    url(r'^edit/$', PersonUpdateView.as_view(), name="person-update"),
    url(r'^$', IndexView.as_view(), name="index"))
Esempio n. 12
0
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from haystack.views import FacetedSearchView
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet


# Now we set up the facets we want to include with every query
sqs = SearchQuerySet()
sqs = sqs.facet('django_ct')
sqs = sqs.facet('session_kind')
sqs = sqs.facet('track')
sqs = sqs.facet('tag')


urlpatterns = patterns('',
                       url(r'^/?$',
                           FacetedSearchView(searchqueryset=sqs,
                                             load_all=False,
                                             form_class=FacetedSearchForm)),
                       )
Esempio n. 13
0
from django.conf.urls import include, patterns, url
from django.contrib import admin

from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet
from haystack.views import FacetedSearchView, SearchView

admin.autodiscover()


urlpatterns = patterns('',
    (r'^admin/', include(admin.site.urls)),
)


urlpatterns += patterns('haystack.views',
    url(r'^$', SearchView(load_all=False), name='haystack_search'),
    url(r'^faceted/$', FacetedSearchView(searchqueryset=SearchQuerySet().facet('author'), form_class=FacetedSearchForm), name='haystack_faceted_search'),
    url(r'^basic/$', 'basic_search', {'load_all': False}, name='haystack_basic_search'),
)

urlpatterns += patterns('app-without-models',
    url(r'', include('test_haystack.test_app_without_models.urls', namespace='app-without-models')),
)
Esempio n. 14
0
from django.conf.urls.defaults import *
from search.views import TextSearchView
from django.contrib.auth.decorators import login_required
from search.forms import TextSearchForm
from haystack.views import FacetedSearchView
from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet

sqs = SearchQuerySet().all().facet('category')

urlpatterns = patterns(
    '',
    (r'^search$',
     login_required(
         TextSearchView(template="app/search/search.xhtml",
                        form_class=TextSearchForm))),
    url(r'^search-entry$',
        FacetedSearchView(template="app/search/search_entry.xhtml",
                          form_class=FacetedSearchForm,
                          searchqueryset=sqs),
        name='haystack_search'),
)
Esempio n. 15
0
 def test_default_form(self):
     fsv = FacetedSearchView()
     fsv.request = HttpRequest()
     fsv.request.GET = QueryDict('')
     fsv.form = fsv.build_form()
     self.assertTrue(isinstance(fsv.form, FacetedSearchForm))
Esempio n. 16
0

admin.autodiscover()



sqs = SearchQuerySet().all().facet('category').facet('subcategory')





urlpatterns = patterns('',

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', FacetedSearchView(form_class=FacetedSearchForm, searchqueryset=sqs), name='haystack_search'),



    (r'^media/(?P<path>.*)$', 'django.views.static.serve',
         {'document_root': settings.MEDIA_ROOT}),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': settings.MEDIA_ROOT,
        }),
    url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': settings.STATIC_ROOT,
        }),
    
)

Esempio n. 17
0
from django.conf.urls.defaults import *

from haystack.forms import FacetedSearchForm
from haystack.query import SearchQuerySet
from haystack.views import FacetedSearchView

sqs = SearchQuerySet().facet('funder_name').facet('funder_party').facet(
    'funder_committee_type').order_by('-pub_date')

urlpatterns = patterns(
    'haystack.views',
    url(r'^$',
        FacetedSearchView(form_class=FacetedSearchForm,
                          template='search/search.html',
                          searchqueryset=sqs,
                          results_per_page=15),
        name='haystack_search'),
)
Esempio n. 18
0
from haystack.views import FacetedSearchView

import notifications

admin.autodiscover()

sqs = SearchQuerySet().facet('exact_user').facet('exact_location').facet(
    'exact_manager').facet('exact_status')

urlpatterns = patterns(
    '',
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^search/$',
        login_required(
            FacetedSearchView(form_class=FacetedSearchForm,
                              searchqueryset=sqs)),
        name='haystack_search'),
    url(r'', include('social.apps.django_app.urls', namespace='social')),
    url(r'', include('workshift.urls', namespace="workshift")),
    url(r'', include('threads.urls', namespace='threads')),
    url(r'', include('rooms.urls', namespace='rooms')),
    url(r'', include('events.urls', namespace='events')),
    url(r'', include('managers.urls', namespace='managers')),
    url(r'', include('farnswiki.urls')),
)

if "legacy" in settings.INSTALLED_APPS:
    urlpatterns += patterns(
        '',
        url(r'', include('legacy.urls', namespace='legacy')),
    )
Esempio n. 19
0
    # NG: added to include additional views for admin
    # (this is not the recommended way but the only one I got to work)
    #url(r"^admin/core/test_workflows/$", admin.site.admin_view( import_workflows ) ),    
    #url(r"^admin/core/test_data/$", admin.site.admin_view( admin_test_data ) ),    
    url(r'^admin/', include(admin.site.urls)),
    url(r'^djangular/', include('djangular.urls')),    
    url(r'^accounts/password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
        'django.contrib.auth.views.password_reset_confirm',
        {'post_reset_redirect': '/accounts/login/?next=/'}),
    url(r'^accounts/profile/$', 'core.views.user_profile', name='user_profile'),
    url(r'^accounts/profile/edit/$', 'core.views.user_profile_edit', name='user_profile_edit'),
    url(r'^accounts/register/$', RegistrationView.as_view(),
        {'form_class': RegistrationFormUniqueEmail,
         'backend': 'registration.backends.default.DefaultBackend'}, name='registration.views.register'),
    url(r'^accounts/activate/(?P<activation_key>\w+)/$', ActivationView.as_view(),
        {'success_url': '/accounts/login/?next=/accounts/profile/edit',
         'backend': 'registration.backends.default.DefaultBackend'}, name='registration.views.activate'),
    url(r'^accounts/', include('registration.urls')),

    # NG: tastypie API urls
    url(r'^api/', include(v1_api.urls)),
    
    # NG: Haystack (searching and querying) urls
    #url(r'^search/', include('haystack.urls')),
    url(r'^search/', FacetedSearchView(form_class=FacetedSearchForm, searchqueryset=sqs), name='search' ),
    url(r'^typeahead/$', search_typeahead),

    #(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': STATIC_URL+'images/favicon.ico'}),

) + static( MEDIA_URL, document_root=MEDIA_ROOT)
# for "static" see https://docs.djangoproject.com/en/dev/howto/static-files/#serving-other-directories
Esempio n. 20
0
 def test_empty_results(self):
     fsv = FacetedSearchView()
     fsv.request = HttpRequest()
     fsv.request.GET = QueryDict('')
     fsv.form = fsv.build_form()
     self.assert_(isinstance(fsv.get_results(), EmptySearchQuerySet))
Esempio n. 21
0
from django.conf.urls.defaults import url, patterns
from haystack.views import FacetedSearchView
from haystack.query import SearchQuerySet
from search.forms import SuperSearchForm

sqs = SearchQuerySet().facet('author').facet('tags').highlight()

urlpatterns = patterns(
    'haystack.views',
    url(r'^$',
        FacetedSearchView(form_class=SuperSearchForm, searchqueryset=sqs),
        name='haystack_search'),
)
# Router for rest framework
router = DefaultRouter()
router.register('search', SearchAPIView, basename='search')
router.registry.extend(port_router.registry)
router.registry.extend(category_router.registry)
router.registry.extend(buildhistory_router.registry)
router.registry.extend(maintainer_router.registry)
router.registry.extend(variants_router.registry)

urlpatterns = [
    path('', views.index, name='home'),
    path('admin/doc/', include('django.contrib.admindocs.urls')),
    path('admin/', admin.site.urls),
    # URL for advanced search page
    url(r'^search/', FacetedSearchView(
        form_class=AdvancedSearchForm,
        searchqueryset=SearchQuerySet().facet('maintainers').facet('categories').facet('variants'),
    ), name='search'),
    path('statistics/', include('stats.urls')),
    path('maintainer/', include('maintainer.urls')),
    path('port/', include('port.urls')),
    url(r"api/v1/statistics/port/monthly", PortMonthlyInstallationsAPIView.as_view(), name='port-monthly-stats'),
    url(r"api/v1/statistics/port", PortStatisticsAPIView.as_view(), name='port-stats'),
    url(r"api/v1/statistics/", GeneralStatisticsAPIView.as_view(), name='general-stats'),
    url(r"api/v1/user/followed_ports", FollowedPortsAPIView.as_view(), name='followed-ports'),
    url(r"api/v1/", include(router.urls)),
    path('category/', include('category.urls')),
    path('variant/', include('variant.urls')),
    path('ports/search/', views.search, name='ports_search'),
    path('all_builds/', include('buildhistory.urls')),
    path('about/', views.about_page, name='about_page'),
    path('accounts/', include('allauth.urls')),
Esempio n. 23
0
 def __init__(self, *args, **kwargs):
     sqs = SearchQuerySet().order_by('name').facet('category')
     FacetedSearchView.__init__(self, searchqueryset=sqs, form_class=RoomSearchForm)