diff --git a/ietf/community/models.py b/ietf/community/models.py index b3e265767..3f7268a5c 100644 --- a/ietf/community/models.py +++ b/ietf/community/models.py @@ -24,8 +24,9 @@ class CommunityList(models.Model): return self.long_name() def get_absolute_url(self): + import ietf.community.views if self.user: - return urlreverse("community_personal_view_list", kwargs={ 'username': self.user.username }) + return urlreverse(ietf.community.views.view_list, kwargs={ 'username': self.user.username }) elif self.group: return urlreverse("group_docs", kwargs={ 'acronym': self.group.acronym }) return "" diff --git a/ietf/community/tests.py b/ietf/community/tests.py index 6cbd5ad34..b712ee821 100644 --- a/ietf/community/tests.py +++ b/ietf/community/tests.py @@ -8,6 +8,7 @@ from django.contrib.auth.models import User from ietf.community.models import CommunityList, SearchRule, EmailSubscription from ietf.community.utils import docs_matching_community_list_rule, community_list_rules_matching_doc from ietf.community.utils import reset_name_contains_index_for_rule +import ietf.community.views from ietf.group.utils import setup_default_community_list_for_group from ietf.doc.models import State from ietf.doc.utils import add_state_change_event @@ -63,7 +64,7 @@ class CommunityListTests(TestCase): def test_view_list(self): draft = make_test_data() - url = urlreverse("community_personal_view_list", kwargs={ "username": "plain" }) + url = urlreverse(ietf.community.views.view_list, kwargs={ "username": "plain" }) # without list r = self.client.get(url) @@ -85,7 +86,7 @@ class CommunityListTests(TestCase): def test_manage_personal_list(self): draft = make_test_data() - url = urlreverse("community_personal_manage_list", kwargs={ "username": "plain" }) + url = urlreverse(ietf.community.views.manage_list, kwargs={ "username": "plain" }) login_testing_unauthorized(self, "plain", url) r = self.client.get(url) @@ -149,7 +150,7 @@ class CommunityListTests(TestCase): def test_manage_group_list(self): draft = make_test_data() - url = urlreverse("community_group_manage_list", kwargs={ "acronym": draft.group.acronym }) + url = urlreverse(ietf.community.views.manage_list, kwargs={ "acronym": draft.group.acronym }) setup_default_community_list_for_group(draft.group) login_testing_unauthorized(self, "marschairman", url) @@ -160,7 +161,7 @@ class CommunityListTests(TestCase): def test_track_untrack_document(self): draft = make_test_data() - url = urlreverse("community_personal_track_document", kwargs={ "username": "plain", "name": draft.name }) + url = urlreverse(ietf.community.views.track_document, kwargs={ "username": "plain", "name": draft.name }) login_testing_unauthorized(self, "plain", url) # track @@ -173,7 +174,7 @@ class CommunityListTests(TestCase): self.assertEqual(list(clist.added_docs.all()), [draft]) # untrack - url = urlreverse("community_personal_untrack_document", kwargs={ "username": "plain", "name": draft.name }) + url = urlreverse(ietf.community.views.untrack_document, kwargs={ "username": "plain", "name": draft.name }) r = self.client.get(url) self.assertEqual(r.status_code, 200) @@ -185,7 +186,7 @@ class CommunityListTests(TestCase): def test_track_untrack_document_through_ajax(self): draft = make_test_data() - url = urlreverse("community_personal_track_document", kwargs={ "username": "plain", "name": draft.name }) + url = urlreverse(ietf.community.views.track_document, kwargs={ "username": "plain", "name": draft.name }) login_testing_unauthorized(self, "plain", url) # track @@ -196,7 +197,7 @@ class CommunityListTests(TestCase): self.assertEqual(list(clist.added_docs.all()), [draft]) # untrack - url = urlreverse("community_personal_untrack_document", kwargs={ "username": "plain", "name": draft.name }) + url = urlreverse(ietf.community.views.untrack_document, kwargs={ "username": "plain", "name": draft.name }) r = self.client.post(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest') self.assertEqual(r.status_code, 200) self.assertEqual(json.loads(r.content)["success"], True) @@ -206,7 +207,7 @@ class CommunityListTests(TestCase): def test_csv(self): draft = make_test_data() - url = urlreverse("community_personal_csv", kwargs={ "username": "plain" }) + url = urlreverse(ietf.community.views.export_to_csv, kwargs={ "username": "plain" }) # without list r = self.client.get(url) @@ -229,7 +230,7 @@ class CommunityListTests(TestCase): def test_csv_for_group(self): draft = make_test_data() - url = urlreverse("community_group_csv", kwargs={ "acronym": draft.group.acronym }) + url = urlreverse(ietf.community.views.export_to_csv, kwargs={ "acronym": draft.group.acronym }) setup_default_community_list_for_group(draft.group) @@ -240,7 +241,7 @@ class CommunityListTests(TestCase): def test_feed(self): draft = make_test_data() - url = urlreverse("community_personal_feed", kwargs={ "username": "plain" }) + url = urlreverse(ietf.community.views.feed, kwargs={ "username": "plain" }) # without list r = self.client.get(url) @@ -267,7 +268,7 @@ class CommunityListTests(TestCase): def test_feed_for_group(self): draft = make_test_data() - url = urlreverse("community_group_feed", kwargs={ "acronym": draft.group.acronym }) + url = urlreverse(ietf.community.views.feed, kwargs={ "acronym": draft.group.acronym }) setup_default_community_list_for_group(draft.group) @@ -278,7 +279,7 @@ class CommunityListTests(TestCase): def test_subscription(self): draft = make_test_data() - url = urlreverse("community_personal_subscription", kwargs={ "username": "plain" }) + url = urlreverse(ietf.community.views.subscription, kwargs={ "username": "plain" }) login_testing_unauthorized(self, "plain", url) @@ -315,7 +316,7 @@ class CommunityListTests(TestCase): def test_subscription_for_group(self): draft = make_test_data() - url = urlreverse("community_group_subscription", kwargs={ "acronym": draft.group.acronym }) + url = urlreverse(ietf.community.views.subscription, kwargs={ "acronym": draft.group.acronym }) setup_default_community_list_for_group(draft.group) diff --git a/ietf/community/urls.py b/ietf/community/urls.py index 73d31c8c6..510d1a350 100644 --- a/ietf/community/urls.py +++ b/ietf/community/urls.py @@ -2,12 +2,12 @@ from django.conf.urls import patterns, url urlpatterns = patterns('', - url(r'^personal/(?P[^/]+)/$', 'ietf.community.views.view_list', name='community_personal_view_list'), - url(r'^personal/(?P[^/]+)/manage/$', 'ietf.community.views.manage_list', name='community_personal_manage_list'), - url(r'^personal/(?P[^/]+)/trackdocument/(?P[^/]+)/$', 'ietf.community.views.track_document', name='community_personal_track_document'), - url(r'^personal/(?P[^/]+)/untrackdocument/(?P[^/]+)/$', 'ietf.community.views.untrack_document', name='community_personal_untrack_document'), - url(r'^personal/(?P[^/]+)/csv/$', 'ietf.community.views.export_to_csv', name='community_personal_csv'), - url(r'^personal/(?P[^/]+)/feed/$', 'ietf.community.views.feed', name='community_personal_feed'), - url(r'^personal/(?P[^/]+)/subscription/$', 'ietf.community.views.subscription', name='community_personal_subscription'), + url(r'^personal/(?P[^/]+)/$', 'ietf.community.views.view_list'), + url(r'^personal/(?P[^/]+)/manage/$', 'ietf.community.views.manage_list'), + url(r'^personal/(?P[^/]+)/trackdocument/(?P[^/]+)/$', 'ietf.community.views.track_document'), + url(r'^personal/(?P[^/]+)/untrackdocument/(?P[^/]+)/$', 'ietf.community.views.untrack_document'), + url(r'^personal/(?P[^/]+)/csv/$', 'ietf.community.views.export_to_csv'), + url(r'^personal/(?P[^/]+)/feed/$', 'ietf.community.views.feed'), + url(r'^personal/(?P[^/]+)/subscription/$', 'ietf.community.views.subscription'), ) diff --git a/ietf/group/info.py b/ietf/group/info.py index 1fa1f315f..d88c43d02 100644 --- a/ietf/group/info.py +++ b/ietf/group/info.py @@ -378,7 +378,8 @@ def construct_group_menu_context(request, group, selected, group_type, others): if group.features.has_documents: clist = CommunityList.objects.filter(group=group).first() if clist and can_manage_community_list(request.user, clist): - actions.append((u'Manage document list', urlreverse('community_group_manage_list', kwargs=kwargs))) + import ietf.community.views + actions.append((u'Manage document list', urlreverse(ietf.community.views.manage_list, kwargs=kwargs))) if group.features.has_materials and can_manage_materials(request.user, group): actions.append((u"Upload material", urlreverse("ietf.doc.views_material.choose_material_type", kwargs=kwargs))) diff --git a/ietf/group/urls_info_details.py b/ietf/group/urls_info_details.py index c2ab9952d..a64e0fd4f 100644 --- a/ietf/group/urls_info_details.py +++ b/ietf/group/urls_info_details.py @@ -5,10 +5,10 @@ urlpatterns = patterns('', (r'^$', 'ietf.group.info.group_home', None, "group_home"), (r'^documents/txt/$', 'ietf.group.info.group_documents_txt'), (r'^documents/$', 'ietf.group.info.group_documents', None, "group_docs"), - (r'^documents/manage/$', 'ietf.community.views.manage_list', None, "community_group_manage_list"), - (r'^documents/csv/$', 'ietf.community.views.export_to_csv', None, 'community_group_csv'), - (r'^documents/feed/$', 'ietf.community.views.feed', None, 'community_group_feed'), - (r'^documents/subscription/$', 'ietf.community.views.subscription', None, 'community_group_subscription'), + (r'^documents/manage/$', 'ietf.community.views.manage_list'), + (r'^documents/csv/$', 'ietf.community.views.export_to_csv'), + (r'^documents/feed/$', 'ietf.community.views.feed'), + (r'^documents/subscription/$', 'ietf.community.views.subscription'), (r'^charter/$', 'ietf.group.info.group_about', None, 'group_charter'), (r'^about/$', 'ietf.group.info.group_about', None, 'group_about'), (r'^about/status/$', 'ietf.group.info.group_about_status'), diff --git a/ietf/templates/base/menu.html b/ietf/templates/base/menu.html index 5a394dc8f..f550e3f74 100644 --- a/ietf/templates/base/menu.html +++ b/ietf/templates/base/menu.html @@ -52,7 +52,7 @@ {% endif %} {% if user and user.is_authenticated %} -
  • My tracked docs
  • +
  • My tracked docs
  • {% for g in user|managed_groups %}
  • {{ g.acronym }} {{ g.type.slug }} docs
  • diff --git a/ietf/templates/community/list_menu.html b/ietf/templates/community/list_menu.html index f1c1fc62e..10a77673b 100644 --- a/ietf/templates/community/list_menu.html +++ b/ietf/templates/community/list_menu.html @@ -2,13 +2,13 @@
  • {% if clist.pk != None %} -
  • +
  • {% if subscribed %} Change subscription @@ -18,5 +18,5 @@
  • {% endif %} -
  • Export as CSV
  • +
  • Export as CSV
  • diff --git a/ietf/templates/community/manage_clist.html b/ietf/templates/community/manage_clist.html index 624e9b3aa..2a46ab5ae 100644 --- a/ietf/templates/community/manage_clist.html +++ b/ietf/templates/community/manage_clist.html @@ -50,7 +50,7 @@ {{ doc.display_name }} {{ doc.get_state }} {{ doc.title }} - Remove + Remove {% endfor %} diff --git a/ietf/templates/community/view_list.html b/ietf/templates/community/view_list.html index e329180ae..1ac5d54c0 100644 --- a/ietf/templates/community/view_list.html +++ b/ietf/templates/community/view_list.html @@ -12,7 +12,7 @@ {% bootstrap_messages %} {% if can_manage_list %} - + Manage list diff --git a/ietf/templates/doc/document_draft.html b/ietf/templates/doc/document_draft.html index 184b0cab7..4c66aa8b3 100644 --- a/ietf/templates/doc/document_draft.html +++ b/ietf/templates/doc/document_draft.html @@ -501,8 +501,8 @@ {% if user.is_authenticated %} - Untrack - Track + Untrack + Track {% endif %} {% if can_edit and iesg_state %} diff --git a/ietf/templates/doc/search/search_result_row.html b/ietf/templates/doc/search/search_result_row.html index 916786b6e..f9c473a34 100644 --- a/ietf/templates/doc/search/search_result_row.html +++ b/ietf/templates/doc/search/search_result_row.html @@ -13,10 +13,10 @@ {% if user.is_authenticated %} - + - + {% endif %}