Mercurial > public > sg101
annotate custom_search/views.py @ 861:e4f8d87c3d30
Configure Markdown logger to reduce noise in logs.
Markdown is logging at the INFO level whenever it loads an extension.
This looks like it has been fixed in master at GitHub. But until then
we will explicitly configure the MARKDOWN logger to log at WARNING
or higher.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 01 Dec 2014 18:36:27 -0600 |
parents | 20a3bf7a6370 |
children | 840c1a8bd8af |
rev | line source |
---|---|
bgneal@763 | 1 """Custom views for searching.""" |
bgneal@763 | 2 |
bgneal@763 | 3 from haystack.views import SearchView |
bgneal@763 | 4 |
bgneal@763 | 5 |
bgneal@763 | 6 class UserSearchView(SearchView): |
bgneal@763 | 7 """This class passes the user making the search as an __init__ argument to |
bgneal@763 | 8 the search form as the keyword argument 'user'. |
bgneal@763 | 9 |
bgneal@763 | 10 """ |
bgneal@763 | 11 def build_form(self, form_kwargs=None): |
bgneal@763 | 12 """Pass the request.user object to the form's constructor.""" |
bgneal@763 | 13 if not form_kwargs: |
bgneal@763 | 14 form_kwargs = {} |
bgneal@763 | 15 if 'user' not in form_kwargs: |
bgneal@763 | 16 form_kwargs['user'] = self.request.user |
bgneal@763 | 17 return super(UserSearchView, self).build_form(form_kwargs) |