* Add filename_with_link to create links only for active documents

* Display document status if it's not Active
* Use revision_display in displayname()
* Check for DocumentComment.created_by flag value of 999
 - Legacy-Id: 317
This commit is contained in:
Bill Fenner 2007-06-11 18:47:44 +00:00
parent e7a13bff68
commit ea639f96c4
3 changed files with 15 additions and 7 deletions

View file

@ -147,7 +147,7 @@ class InternetDraft(models.Model):
self.id_document_key = self.title.upper()
super(InternetDraft, self).save()
def displayname(self):
return "%s-%s.txt" % ( self.filename, self.revision )
return "%s-%s.txt" % ( self.filename, self.revision_display() )
def doclink(self):
return "http://www.ietf.org/internet-drafts/%s" % ( self.displayname() )
def group_acronym(self):
@ -167,7 +167,11 @@ class InternetDraft(models.Model):
return "%02d" % r
def doctype(self):
return "Draft"
def filename_with_link(self):
if self.status.status != 'Active':
return self.filename
else:
return '<a href="%s">%s</a>' % ( self.doclink(), self.filename )
class Meta:
db_table = "internet_drafts"
class Admin:
@ -335,6 +339,8 @@ class Rfc(models.Model):
return "http://www.ietf.org/rfc/%s" % ( self.displayname() )
def doctype(self):
return "RFC"
def filename_with_link(self):
return '<a href="%s">%s</a>' % ( self.doclink(), self.displayname() )
class Meta:
db_table = 'rfcs'
verbose_name = 'RFC'
@ -503,12 +509,12 @@ class DocumentComment(models.Model):
else:
return "/idtracker/%s/comment/%d/" % (self.document.draft.filename, self.id)
def get_author(self):
if self.created_by:
if self.created_by_id and self.created_by_id != 999:
return self.created_by.__str__()
else:
return "system"
def get_username(self):
if self.created_by:
if self.created_by_id and self.created_by_id != 999:
return self.created_by.login_name
else:
return "system"

View file

@ -29,8 +29,10 @@
<td>
<div class="largefont3">
<a href="{{ object.document.doclink }}">
{{ object.document.displayname }}</a>
{{ object.document.filename_with_link }}
{% ifnotequal object.document.status.status "Active" %}
({{ object.document.status.status }})
{% endifnotequal %}
<font color="red">
{% if object.via_rfc_editor %}
(Independent submission via RFC Editor)

View file

@ -5,7 +5,7 @@
invalid HTML. -->
<form method="GET" action="{% url ietf.idtracker.views.view_id match.document.filename %}"><td><input type="submit" value="DETAIL"></td></form>
{# todo: conditionalize doclink properly #}
<td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}<a href="{{ match.document.doclink }}">{{ match.document.filename }}</a> ({{ match.document.intended_status }})</td>
<td>{% if match.primary_flag %}<li>{% else %}<dd>{% endif %}{{ match.document.filename_with_link }} ({{ match.document.intended_status }})</td>
<td>{{ match.document.revision }}</td>
<td>{{ match.job_owner }}</td>
<td>{% firstof match.status_date "" %}</td>