Skip to content

Commit e096671

Browse files
committed
Added the ability to search for documents from a certain stream to the main document search form.
- Legacy-Id: 6201
1 parent e81ce38 commit e096671

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

ietf/doc/views_search.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ class SearchForm(forms.Form):
5454
activedrafts = forms.BooleanField(required=False, initial=True)
5555
olddrafts = forms.BooleanField(required=False, initial=False)
5656

57-
by = forms.ChoiceField(choices=[(x,x) for x in ('author','group','area','ad','state')], required=False, initial='wg', label='Foobar')
57+
by = forms.ChoiceField(choices=[(x,x) for x in ('author','group','area','ad','state','stream')], required=False, initial='wg')
5858
author = forms.CharField(required=False)
5959
group = forms.CharField(required=False)
60+
stream = forms.ModelChoiceField(StreamName.objects.all().order_by('name'), empty_label="any stream", required=False)
6061
area = forms.ModelChoiceField(Group.objects.filter(type="area", state="active").order_by('name'), empty_label="any area", required=False)
6162
ad = forms.ChoiceField(choices=(), required=False)
6263
state = forms.ModelChoiceField(State.objects.filter(type="draft-iesg"), empty_label="any state", required=False)
@@ -298,6 +299,8 @@ def retrieve_search_results(form, all_types=False):
298299
docs = docs.filter(states=query["state"])
299300
if query["substate"]:
300301
docs = docs.filter(tags=query["substate"])
302+
elif by == "stream":
303+
docs = docs.filter(stream__slug=query["stream"])
301304

302305
# evaluate and fill in attribute results immediately to cut down
303306
# the number of queries

ietf/templates/doc/search/search_form.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
<div class="search_field">
8080
<label><input type="radio" class="radio" name="by" value="state" {% if meta.by == "state" %}checked="checked"{% endif %}/> IESG State:</label> {{ form.state }} :: {{ form.substate }}
8181
</div>
82+
<div class="search_field">
83+
<label><input type="radio" class="radio" name="by" value="stream" {% if meta.by == "stream" %}checked="checked"{% endif %}/> Stream:</label> {{ form.stream }}
84+
</div>
8285

8386
</div><!-- end of advanced -->
8487

0 commit comments

Comments
 (0)