Skip to content

Commit 178c5e1

Browse files
committed
* search_result_row.html no longer takes care of the ballot set rendering for you; you have to pass it the entire contents of the ballot set.
* Model and template changes to allow documents to report their name via doctype() to allow "Draft Name:" vs. "RFC Name:" * Add parenthesis around the submission type to match the cgi * Pass the whole ballot set to search_result_row from idinternal_detail * Display only public comments in idinternal_detail * Use comment.get_absolute_url instead of a relative URL. (This fixes /idtracker/NNN/comment/YYY/ which wouldn't work) * Add a search url to compare * In view, when searching, don't filter for primary_flag=1, but do order by ballot and -primary_flag so that the results are grouped properly. * Introduce public_comments() accessor which filters comments() * Fix comments() to not use rfc_flag, to match the schema * Order ballot_set() by -primary_flag so the results are grouped properly. - Legacy-Id: 312
1 parent 8f81a7a commit 178c5e1

5 files changed

Lines changed: 20 additions & 24 deletions

File tree

ietf/idtracker/models.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def revision_display(self):
165165
if self.status.status != 'Active' and not self.expired_tombstone:
166166
r = max(r - 1, 0)
167167
return "%02d" % r
168+
def doctype(self):
169+
return "Draft"
168170

169171
class Meta:
170172
db_table = "internet_drafts"
@@ -331,6 +333,8 @@ def revision(self):
331333
return "RFC"
332334
def doclink(self):
333335
return "http://www.ietf.org/rfc/%s" % ( self.displayname() )
336+
def doctype(self):
337+
return "RFC"
334338
class Meta:
335339
db_table = 'rfcs'
336340
verbose_name = 'RFC'
@@ -454,14 +458,14 @@ def document(self):
454458
return self._cached_rfc
455459
else:
456460
return self.draft
461+
def public_comments(self):
462+
return self.comments().filter(public_flag=1)
457463
def comments(self):
458-
if self.rfc_flag == 0:
459-
filter = models.Q(rfc_flag=0)|models.Q(rfc_flag__isnull=True)
460-
else:
461-
filter = models.Q(rfc_flag=1)
462-
return self.documentcomment_set.all().filter(filter).order_by('-comment_date','-comment_time')
464+
# would filter by rfc_flag but the database is broken. (see
465+
# trac ticket #96) so this risks collisions.
466+
return self.documentcomment_set.all().order_by('-comment_date','-comment_time','-id')
463467
def ballot_set(self):
464-
return IDInternal.objects.filter(ballot=self.ballot_id)
468+
return IDInternal.objects.filter(ballot=self.ballot_id).order_by('-primary_flag')
465469
def ballot_primary(self):
466470
return IDInternal.objects.filter(ballot=self.ballot_id,primary_flag=1)
467471
def ballot_others(self):

ietf/idtracker/testurls.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
200 /idtracker/ballot/1760/ https://datatracker.ietf.org/public/pidtracker.cgi?command=print_ballot&ballot_id=1760&filename=draft-ietf-isis-link-attr
1515
200 /idtracker/ https://datatracker.ietf.org/public/pidtracker.cgi
1616
200 /feeds/comments/draft-ietf-isis-link-attr/
17+
200 /idtracker/?search_filename=bgp-m https://datatracker.ietf.org/public/pidtracker.cgi?command=search_list&search_job_owner=0&search_group_acronym=&search_status_id=&search_cur_state=&sub_state_id=6&search_filename=bgp-m&search_rfcnumber=&search_area_acronym=&search_button=SEARCH

ietf/idtracker/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def search(request):
6060
status = args.get('search_status_id', '')
6161
if status != '':
6262
q_objs.append(Q(draft__status=status,rfc_flag=0))
63-
matches = IDInternal.objects.all().filter(*q_objs).filter(primary_flag=1)
64-
matches = matches.order_by('cur_state', 'cur_sub_state_id')
63+
matches = IDInternal.objects.all().filter(*q_objs)
64+
matches = matches.order_by('cur_state', 'cur_sub_state', 'ballot')
6565
else:
6666
matches = None
6767

ietf/templates/idtracker/idinternal_detail.html

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<tr bgcolor="white">
2424
<td>
2525
<div class="largefont3">
26-
Draft Name:
26+
{{ object.document.doctype }} Name:
2727
</div>
2828
</td>
2929

@@ -33,12 +33,12 @@
3333
{{ object.document.displayname }}</a>
3434
<font color="red">
3535
{% if object.via_rfc_editor %}
36-
Independent submission via RFC Editor
36+
(Independent submission via RFC Editor)
3737
{% else %}
3838
{% ifequal object.document.group_acronym "none" %}
39-
Individual submission
39+
(Individual submission)
4040
{% else %}
41-
WG &lt;{{ object.document.group_acronym }}&gt; submission
41+
(WG &lt;{{ object.document.group_acronym }}&gt; submission)
4242
{% endifequal %}
4343
{% endif %}
4444
</font>
@@ -207,11 +207,7 @@
207207
<a name="action"></a>
208208
<table border="1" bgcolor="black">
209209
<tr><td><font color="white"><h3>Actions</h3></font>
210-
{% comment %}
211-
# this "regroup" is to get the data structure into the shape
212-
# that search_result_table wants - it doesn't do anything real.
213-
{% endcomment %}
214-
{% regroup object.ballot_primary by docstate as grouped %}
210+
{% regroup object.ballot_set by docstate as grouped %}
215211
{% include "idtracker/search_result_table.html" %}
216212
</td>
217213
</tr>
@@ -229,7 +225,7 @@ <h3>Comment Log</h3>
229225
<th>Comment</th>
230226
</tr>
231227

232-
{% for comment in object.comments %}
228+
{% for comment in object.public_comments %}
233229
<tr bgcolor="{% cycle #CFE1CC,#7DC189 %}">
234230
<td>{{ comment.date }}</td>
235231

@@ -245,7 +241,7 @@ <h3>Comment Log</h3>
245241
but that actually changes the visible spacing in most
246242
browsers, so we let layout concerns make us write
247243
invalid HTML. -->
248-
<form action="comment/{{ comment.id }}" method="GET">
244+
<form action="{{ comment.get_absolute_url }}" method="GET">
249245
<td>
250246
<input type="submit" value="View Detail">
251247
</td>

ietf/templates/idtracker/search_result_table.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ <h3>In State: <a href="/idtracker/states/{{ group.list.0.cur_state_id }}/">{{ gr
44
<tr bgcolor="#A3A3A3"><th>&nbsp;</th><th width="250">Name (Intended Status)</th><th>Ver</th><th>Responsible AD</th><th>Status Date</th><th>Modified</th></tr>
55
{% for match in group.list %}
66
{% include "idtracker/search_result_row.html" %}
7-
{% if match.primary_flag %}
8-
{% for match in match.ballot_others %}
9-
{% include "idtracker/search_result_row.html" %}
10-
{% endfor %}
11-
{% endif %}
127
{% endfor %}
138
</table>
149
{% endfor %}

0 commit comments

Comments
 (0)