From 178c5e13e0f25a094904c9fb7fbdfa54f2eecbe5 Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Mon, 11 Jun 2007 16:53:25 +0000 Subject: [PATCH] * 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 --- ietf/idtracker/models.py | 16 ++++++++++------ ietf/idtracker/testurls.list | 1 + ietf/idtracker/views.py | 4 ++-- .../templates/idtracker/idinternal_detail.html | 18 +++++++----------- .../idtracker/search_result_table.html | 5 ----- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/ietf/idtracker/models.py b/ietf/idtracker/models.py index 40138cdd0..89301149b 100644 --- a/ietf/idtracker/models.py +++ b/ietf/idtracker/models.py @@ -165,6 +165,8 @@ class InternetDraft(models.Model): if self.status.status != 'Active' and not self.expired_tombstone: r = max(r - 1, 0) return "%02d" % r + def doctype(self): + return "Draft" class Meta: db_table = "internet_drafts" @@ -331,6 +333,8 @@ class Rfc(models.Model): return "RFC" def doclink(self): return "http://www.ietf.org/rfc/%s" % ( self.displayname() ) + def doctype(self): + return "RFC" class Meta: db_table = 'rfcs' verbose_name = 'RFC' @@ -454,14 +458,14 @@ class IDInternal(models.Model): return self._cached_rfc else: return self.draft + def public_comments(self): + return self.comments().filter(public_flag=1) def comments(self): - if self.rfc_flag == 0: - filter = models.Q(rfc_flag=0)|models.Q(rfc_flag__isnull=True) - else: - filter = models.Q(rfc_flag=1) - return self.documentcomment_set.all().filter(filter).order_by('-comment_date','-comment_time') + # would filter by rfc_flag but the database is broken. (see + # trac ticket #96) so this risks collisions. + return self.documentcomment_set.all().order_by('-comment_date','-comment_time','-id') def ballot_set(self): - return IDInternal.objects.filter(ballot=self.ballot_id) + return IDInternal.objects.filter(ballot=self.ballot_id).order_by('-primary_flag') def ballot_primary(self): return IDInternal.objects.filter(ballot=self.ballot_id,primary_flag=1) def ballot_others(self): diff --git a/ietf/idtracker/testurls.list b/ietf/idtracker/testurls.list index 8ebc18ebe..4896ac9aa 100644 --- a/ietf/idtracker/testurls.list +++ b/ietf/idtracker/testurls.list @@ -14,3 +14,4 @@ 200 /idtracker/ballot/1760/ https://datatracker.ietf.org/public/pidtracker.cgi?command=print_ballot&ballot_id=1760&filename=draft-ietf-isis-link-attr 200 /idtracker/ https://datatracker.ietf.org/public/pidtracker.cgi 200 /feeds/comments/draft-ietf-isis-link-attr/ +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 diff --git a/ietf/idtracker/views.py b/ietf/idtracker/views.py index 59c9ccfdb..3d760b3fa 100644 --- a/ietf/idtracker/views.py +++ b/ietf/idtracker/views.py @@ -60,8 +60,8 @@ def search(request): status = args.get('search_status_id', '') if status != '': q_objs.append(Q(draft__status=status,rfc_flag=0)) - matches = IDInternal.objects.all().filter(*q_objs).filter(primary_flag=1) - matches = matches.order_by('cur_state', 'cur_sub_state_id') + matches = IDInternal.objects.all().filter(*q_objs) + matches = matches.order_by('cur_state', 'cur_sub_state', 'ballot') else: matches = None diff --git a/ietf/templates/idtracker/idinternal_detail.html b/ietf/templates/idtracker/idinternal_detail.html index b39ddc9f0..17f8b3760 100644 --- a/ietf/templates/idtracker/idinternal_detail.html +++ b/ietf/templates/idtracker/idinternal_detail.html @@ -23,7 +23,7 @@
- Draft Name: + {{ object.document.doctype }} Name:
@@ -33,12 +33,12 @@ {{ object.document.displayname }} {% if object.via_rfc_editor %} - Independent submission via RFC Editor + (Independent submission via RFC Editor) {% else %} {% ifequal object.document.group_acronym "none" %} - Individual submission + (Individual submission) {% else %} - WG <{{ object.document.group_acronym }}> submission + (WG <{{ object.document.group_acronym }}> submission) {% endifequal %} {% endif %} @@ -207,11 +207,7 @@ @@ -229,7 +225,7 @@ -{% for comment in object.comments %} +{% for comment in object.public_comments %} @@ -245,7 +241,7 @@ but that actually changes the visible spacing in most browsers, so we let layout concerns make us write invalid HTML. --> - + diff --git a/ietf/templates/idtracker/search_result_table.html b/ietf/templates/idtracker/search_result_table.html index 966f0a4e3..d8ddea07d 100644 --- a/ietf/templates/idtracker/search_result_table.html +++ b/ietf/templates/idtracker/search_result_table.html @@ -4,11 +4,6 @@ {% for match in group.list %} {% include "idtracker/search_result_row.html" %} - {% if match.primary_flag %} - {% for match in match.ballot_others %} - {% include "idtracker/search_result_row.html" %} - {% endfor %} - {% endif %} {% endfor %}

Actions

- {% comment %} - # this "regroup" is to get the data structure into the shape - # that search_result_table wants - it doesn't do anything real. - {% endcomment %} - {% regroup object.ballot_primary by docstate as grouped %} + {% regroup object.ballot_set by docstate as grouped %} {% include "idtracker/search_result_table.html" %}
Comment
{{ comment.date }}
 Name (Intended Status)VerResponsible ADStatus DateModified
{% endfor %}