Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Search on the current release by default if no release is specified.

  • Loading branch information...
commit 91c7a89ce57a38d90c4955401ffa2a8e70effda0 1 parent e9a1b12
@bmispelon bmispelon authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 docs/views.py
View
10 docs/views.py
@@ -110,9 +110,13 @@ def __init__(self, **kwargs):
super(DocSearchView, self).__init__(**kwargs)
def build_form(self, form_kwargs=None):
- form_kwargs = {
- 'default_release': get_object_or_404(DocumentRelease, pk=self.request.GET.get('release'))
- }
+ if form_kwargs is None:
+ form_kwargs = {}
+ pk = self.request.GET.get('release')
+ if pk:
+ form_kwargs['default_release'] = get_object_or_404(DocumentRelease, pk=pk)
+ else:
+ form_kwargs['default_release'] = DocumentRelease.objects.current()
return super(DocSearchView, self).build_form(form_kwargs)
def extra_context(self):
Please sign in to comment.
Something went wrong with that request. Please try again.