|
34 | 34 | from datetime import datetime, time |
35 | 35 | from django.http import HttpResponse, Http404 |
36 | 36 | from django.shortcuts import render_to_response, get_object_or_404 |
37 | | -from ietf.idtracker.models import InternetDraft, IDInternal, BallotInfo |
| 37 | +from ietf.idtracker.models import InternetDraft, IDInternal, BallotInfo, DocumentComment |
38 | 38 | from ietf.idrfc.models import RfcIndex, DraftVersions |
39 | 39 | from ietf.idrfc.idrfc_wrapper import BallotWrapper, IdWrapper, RfcWrapper |
40 | 40 | from ietf.idrfc import markup_txt |
@@ -147,14 +147,18 @@ def document_main(request, name): |
147 | 147 | # doc is either IdWrapper or RfcWrapper |
148 | 148 | def _get_history(doc): |
149 | 149 | results = [] |
150 | | - if doc._idinternal: |
151 | | - for comment in doc._idinternal.public_comments(): |
152 | | - info = {} |
153 | | - info['text'] = comment.comment_text |
154 | | - info['by'] = comment.get_fullname() |
155 | | - info['textSnippet'] = truncatewords_html(format_textarea(fill(info['text'], 80)), 25) |
156 | | - info['snipped'] = info['textSnippet'][-3:] == "..." |
157 | | - results.append({'comment':comment, 'info':info, 'date':comment.datetime(), 'is_com':True}) |
| 150 | + if doc.is_id_wrapper: |
| 151 | + comments = DocumentComment.objects.filter(document=doc.tracker_id) |
| 152 | + else: |
| 153 | + # note: DocumentComment.rfc_flag is often wrong; avoid it |
| 154 | + comments = DocumentComment.objects.filter(document=doc.rfc_number) |
| 155 | + for comment in comments.order_by('-date','-time','-id').filter(public_flag=1).select_related('created_by'): |
| 156 | + info = {} |
| 157 | + info['text'] = comment.comment_text |
| 158 | + info['by'] = comment.get_fullname() |
| 159 | + info['textSnippet'] = truncatewords_html(format_textarea(fill(info['text'], 80)), 25) |
| 160 | + info['snipped'] = info['textSnippet'][-3:] == "..." |
| 161 | + results.append({'comment':comment, 'info':info, 'date':comment.datetime(), 'is_com':True}) |
158 | 162 | if doc.is_id_wrapper: |
159 | 163 | versions = _get_versions(doc._draft, False) |
160 | 164 | versions.reverse() |
|
0 commit comments