I'm new to Django...
I have installed a Django external App called Haystack, this external App have a "views.py" file inside "python2.6/site-packages/haystack". I think this "views.py" is called a "generic view" in Django terms.
This generic view is called using "urls.py" like this:
urlpatterns = patterns('haystack.views',
url(r'^search/$', FacetedSearchView(form_class=FacetedSearchForm, searchqueryset=sqs), name='haystack_search'),
)
I need to make the jump from this generic views to my App. My question goes in the direction of How Can I Do This?
The code of Haystack "views.py" goes like this:
from django.conf import settings
from django.core.paginator import Paginator, InvalidPage
from django.http import Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from haystack.forms import ModelSearchForm, FacetedSearchForm
from haystack.query import EmptySearchQuerySet
RESULTS_PER_PAGE = getattr(settings, 'HAYSTACK_SEARCH_RESULTS_PER_PAGE', 20)
class SearchView(object):
...
def __init__(self, template=None, load_all=True, form_class=None, searchqueryset=None, context_class=RequestContext, results_per_page=None):
...
def __call__(self, request):
...
def build_form(self, form_kwargs=None):
...
def get_query(self):
...
def get_results(self):
...
def build_page(self):
...
def extra_context(self):
...
def create_response(self):
...
def search_view_factory(view_class=SearchView, *args, **kwargs):
...
class FacetedSearchView(SearchView):
...
def __init__(self, *args, **kwargs):
...
def build_form(self, form_kwargs=None):
...
def extra_context(self):
...
def basic_search(request, template='search/search.html', load_all=True, form_class=ModelSearchForm, searchqueryset=None, context_class=RequestContext, extra_context=None, results_per_page=None):
...
Can someone give what steps I should follow to take out the code from the "urls.py" and put the thing working in my "views.py" App?
Best Regards,