Beispiel #1
0
 def setUp(self):
     super(AutoSiteRegistrationTestCase, self).setUp()
     
     # Stow.
     import haystack
     self.old_site = haystack.site
     test_site = haystack.sites.SearchSite()
     haystack.site = test_site
     
     haystack.autodiscover()
import haystack
haystack.autodiscover()
from settings import HAYSTACK_SITECONF
import haystack
haystack.autodiscover()
  
Beispiel #4
0
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls.defaults import *
from django.http import HttpResponseServerError
from django.template import loader
from django.shortcuts import RequestContext, render
from django.views.generic.simple import direct_to_template

if 'haystack' in settings.INSTALLED_APPS:
    import haystack; haystack.autodiscover() # autodiscover search indexes
if 'django.contrib.admin' in settings.INSTALLED_APPS:
    from django.contrib import admin; admin.autodiscover()

from narwhal.core.profile.forms import LoginForm

handler500 = lambda request: HttpResponseServerError(loader.get_template('500.html').render(RequestContext(request)))

urlpatterns = patterns('', 
        url(r'^login', 'django.contrib.auth.views.login', {'template_name':'login.html', 'authentication_form': LoginForm}, name='login'),
        url(r'^logout', 'django.contrib.auth.views.logout', {'template_name':'logout.html'}, name='logout'),
        
        url(r'^admin/', include(admin.site.urls)),
        
        url(r'^$', direct_to_template, {'template':'home.html'}, name='home'),
        url(r'^tracker/', include('narwhal.core.tracker.urls', namespace='tracker')),
        url(r'^torrents/', include('narwhal.core.torrent.urls', namespace='torrent')),
        url(r'^profile/', include('narwhal.core.profile.urls', namespace='profile')),
        url(r'^account/', include('django_authopenid.urls')),
        
        url(r'^500', handler500, name='500'),
        url(r'^404', handler404, name='404'),
Beispiel #5
0
 def _rebuild_searchindex(self):
     haystack.autodiscover()
     call_command('rebuild_index', verbosity=1, interactive=False)
Beispiel #6
0
import haystack; haystack.autodiscover()
from haystack.indexes import *
from haystack import site, indexes, autodiscover
from catalog.models import Product


class ProductIndex(indexes.SearchIndex):
    text = indexes.EdgeNgramField(document=True, use_template=True)
    name = CharField(model_attr='name')
    description = CharField(model_attr='description')
    #get_queryset is deprecated
    def index_queryset(self):
        return Product.objects.all()
        
site.register(Product, ProductIndex)

autodiscover()
Beispiel #8
0
from haystack.indexes import *
from haystack import site, indexes, autodiscover
from catalog.models import Product


class ProductIndex(indexes.SearchIndex):
    text = indexes.EdgeNgramField(document=True, use_template=True)
    name = CharField(model_attr='name')
    description = CharField(model_attr='description')

    #get_queryset is deprecated
    def index_queryset(self):
        return Product.objects.all()


site.register(Product, ProductIndex)

autodiscover()