Skip to content

Commit

Permalink
Removing urls.py as app.py is currently used instead
Browse files Browse the repository at this point in the history
Switching to using the module loader to allow for easier overriding
SearchQuerySet.facet returns a clone of itself so we have to assign is back to itself whenever we add a new facet
  • Loading branch information
Jonathan Moss committed Jul 16, 2012
1 parent 3d0fead commit 163b337
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
11 changes: 6 additions & 5 deletions oscar/apps/search/app.py
Expand Up @@ -3,10 +3,11 @@
from haystack.query import SearchQuerySet

from oscar.core.application import Application
from oscar.apps.search.views import SuggestionsView, MultiFacetedSearchView
from oscar.apps.search.search_indexes import ProductIndex
from oscar.apps.search.forms import MultiFacetedSearchForm
from oscar.core.loading import import_module

import_module('search.views', ['SuggestionsView', 'MultiFacetedSearchView'], locals())
import_module('search.search_indexes', ['ProductIndex'], locals())
import_module('search.forms', ['MultiFacetedSearchForm'], locals())

class SearchApplication(Application):
name = 'search'
Expand All @@ -19,7 +20,7 @@ def get_urls(self):
for field_name, field in ProductIndex.fields.items():
if field.faceted is True:
# Ensure we facet the results set by the defined facetable fields
sqs.facet(field_name)
sqs = sqs.facet(field_name)

urlpatterns = patterns('',
url(r'^suggest/$', self.suggestions_view.as_view(), name='suggest'),
Expand All @@ -29,4 +30,4 @@ def get_urls(self):
return self.post_process_urls(urlpatterns)


application = SearchApplication()
application = SearchApplication()
20 changes: 0 additions & 20 deletions oscar/apps/search/urls.py

This file was deleted.

0 comments on commit 163b337

Please sign in to comment.