diff --git a/ietf/community/views.py b/ietf/community/views.py index 604548239..5c5243de7 100644 --- a/ietf/community/views.py +++ b/ietf/community/views.py @@ -15,7 +15,7 @@ from django.utils.http import urlquote from ietf.community.models import CommunityList, Rule, EmailSubscription, ListNotification from ietf.community.forms import RuleForm, DisplayForm, SubscribeForm, UnSubscribeForm from ietf.group.models import Group -from ietf.doc.models import Document, DocEvent +from ietf.doc.models import Document, DocEvent, DocAlias def _manage_list(request, clist): @@ -77,7 +77,7 @@ def add_document(request, document_name): path = urlquote(request.get_full_path()) tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path return HttpResponseRedirect('%s?%s=%s' % tup) - doc = get_object_or_404(Document, name=document_name) + doc = get_object_or_404(DocAlias, name=document_name).document clist = CommunityList.objects.get_or_create(user=request.user)[0] clist.update() return add_document_to_list(request, clist, doc) @@ -89,7 +89,7 @@ def remove_document(request, list_id, document_name): path = urlquote(request.get_full_path()) tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path return HttpResponseRedirect('%s?%s=%s' % tup) - doc = get_object_or_404(Document, name=document_name) + doc = get_object_or_404(DocAlias, name=document_name).document clist.added_ids.remove(doc) clist.update() return HttpResponseRedirect(clist.get_manage_url()) diff --git a/ietf/idrfc/idrfc_wrapper.py b/ietf/idrfc/idrfc_wrapper.py index 3bdd19966..4e9332b29 100644 --- a/ietf/idrfc/idrfc_wrapper.py +++ b/ietf/idrfc/idrfc_wrapper.py @@ -43,6 +43,7 @@ from django.db import models from django.core.urlresolvers import reverse from django.conf import settings import types +import debug BALLOT_ACTIVE_STATES = ['In Last Call', 'Waiting for Writeup', @@ -390,6 +391,12 @@ class RfcWrapper: else: # TODO: get AD name of the draft return None + def filename(self): + debug.show('self') + debug.show('self._rfc') + debug.show('self._rfcindex') + debug.show('self._rfcindex.filename') + return self._rfcindex.filename @models.permalink def get_absolute_url(self): diff --git a/ietf/templates/idrfc/search_result_row.html b/ietf/templates/idrfc/search_result_row.html index 5b71046b5..af19ec72a 100644 --- a/ietf/templates/idrfc/search_result_row.html +++ b/ietf/templates/idrfc/search_result_row.html @@ -37,7 +37,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}"> {% if user.is_authenticated and show_add_to_list %} <td class="addtolist"> -<a href="{% url community_add_document doc.id.draft_name %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a> +{% if doc.id %} + <a href="{% url community_add_document doc.id.draft_name %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a> +{% else %} + <a href="{% url community_add_document doc.rfc.filename %}" title="Add to your personal ID list"><img src="/images/add_to_list.png" alt="Add to your personal ID list" /></a> +{% endif %} </td> {% endif %} <td class="doc">