Fix a bug which made the community tracking code crash when search results would show an old RFC without an associated draft.
- Legacy-Id: 4569
This commit is contained in:
parent
71894599bf
commit
c8af089ab1
|
@ -15,7 +15,7 @@ from django.utils.http import urlquote
|
||||||
from ietf.community.models import CommunityList, Rule, EmailSubscription, ListNotification
|
from ietf.community.models import CommunityList, Rule, EmailSubscription, ListNotification
|
||||||
from ietf.community.forms import RuleForm, DisplayForm, SubscribeForm, UnSubscribeForm
|
from ietf.community.forms import RuleForm, DisplayForm, SubscribeForm, UnSubscribeForm
|
||||||
from ietf.group.models import Group
|
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):
|
def _manage_list(request, clist):
|
||||||
|
@ -77,7 +77,7 @@ def add_document(request, document_name):
|
||||||
path = urlquote(request.get_full_path())
|
path = urlquote(request.get_full_path())
|
||||||
tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path
|
tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path
|
||||||
return HttpResponseRedirect('%s?%s=%s' % tup)
|
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 = CommunityList.objects.get_or_create(user=request.user)[0]
|
||||||
clist.update()
|
clist.update()
|
||||||
return add_document_to_list(request, clist, doc)
|
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())
|
path = urlquote(request.get_full_path())
|
||||||
tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path
|
tup = settings.LOGIN_URL, REDIRECT_FIELD_NAME, path
|
||||||
return HttpResponseRedirect('%s?%s=%s' % tup)
|
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.added_ids.remove(doc)
|
||||||
clist.update()
|
clist.update()
|
||||||
return HttpResponseRedirect(clist.get_manage_url())
|
return HttpResponseRedirect(clist.get_manage_url())
|
||||||
|
|
|
@ -43,6 +43,7 @@ from django.db import models
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import types
|
import types
|
||||||
|
import debug
|
||||||
|
|
||||||
BALLOT_ACTIVE_STATES = ['In Last Call',
|
BALLOT_ACTIVE_STATES = ['In Last Call',
|
||||||
'Waiting for Writeup',
|
'Waiting for Writeup',
|
||||||
|
@ -390,6 +391,12 @@ class RfcWrapper:
|
||||||
else:
|
else:
|
||||||
# TODO: get AD name of the draft
|
# TODO: get AD name of the draft
|
||||||
return None
|
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
|
@models.permalink
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
|
|
|
@ -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" }}">
|
<tr class="{{ forloop.counter|divisibleby:2|yesno:"oddrow,evenrow" }}">
|
||||||
{% if user.is_authenticated and show_add_to_list %}
|
{% if user.is_authenticated and show_add_to_list %}
|
||||||
<td class="addtolist">
|
<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>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td class="doc">
|
<td class="doc">
|
||||||
|
|
Loading…
Reference in a new issue