Commit 27ad2b72 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Use a custom, styled search input.

parent d2f19ffa
...@@ -6,6 +6,8 @@ from django.conf.urls.static import static ...@@ -6,6 +6,8 @@ from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.contrib import auth from django.contrib import auth
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from website.forms import StyledSearchForm
from haystack.views import SearchView
# Uncomment the next two lines to enable the admin: # Uncomment the next two lines to enable the admin:
admin.autodiscover() admin.autodiscover()
...@@ -40,7 +42,15 @@ urlpatterns = patterns('website.views', ...@@ -40,7 +42,15 @@ urlpatterns = patterns('website.views',
#### SEARCH PAGES #### #### SEARCH PAGES ####
# points to a SearchView Instance # points to a SearchView Instance
url(r'^search/', include('haystack.urls')), #url(r'^search/', include('haystack.urls')),
url(
r'^search/?',
SearchView(
form_class = StyledSearchForm,
results_per_page = 20,
),
name = 'haystack_search',
),
#### ADMIN PAGES #### #### ADMIN PAGES ####
# Uncomment the admin/doc line below to enable admin documentation: # Uncomment the admin/doc line below to enable admin documentation:
......
...@@ -3,6 +3,17 @@ from django import forms ...@@ -3,6 +3,17 @@ from django import forms
from django.db import models from django.db import models
from django.forms import ModelForm, Textarea, TextInput, NumberInput, Select, FileInput from django.forms import ModelForm, Textarea, TextInput, NumberInput, Select, FileInput
from website.models import Seller, Listing from website.models import Seller, Listing
from haystack.forms import SearchForm
class StyledSearchForm( SearchForm ):
q = forms.CharField(
required = False,
label = 'Search',
widget = forms.TextInput(attrs={
'class': 'form-control',
}),
)
class FinalPriceForm( forms.Form ): class FinalPriceForm( forms.Form ):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment