diff --git a/src/postorius/templates/postorius/lists/members.html b/src/postorius/templates/postorius/lists/members.html index 11c231e..5b80575 100644 --- a/src/postorius/templates/postorius/lists/members.html +++ b/src/postorius/templates/postorius/lists/members.html @@ -69,7 +69,7 @@ - {% for member in list.members %} + {% for member in list.member_page %} {{ member.address }} {% trans member.role %} @@ -81,4 +81,22 @@ + + {% endblock main %} diff --git a/src/postorius/templates/postorius/user_mailmansettings.html b/src/postorius/templates/postorius/user_mailmansettings.html index d61343c..6087f98 100644 --- a/src/postorius/templates/postorius/user_mailmansettings.html +++ b/src/postorius/templates/postorius/user_mailmansettings.html @@ -32,9 +32,7 @@

user: {{ mm_user }}

tko

memberships: {{ membership_lists }} - {% for pref in mm_user.preferences %} -

  • {{ pref }}
  • - {% endfor %} +

    {{ mm_user.preferences }}

    List memberships:

    {% for list in mm_user.lists %} @@ -94,8 +92,6 @@ - {% for preference in mm_user.preferences %} - {% endfor %} {% trans "Per-Email subscriptions" %} diff --git a/src/postorius/urls.py b/src/postorius/urls.py index b4f2515..7ca9e59 100644 --- a/src/postorius/urls.py +++ b/src/postorius/urls.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License along with # Postorius. If not, see . -from django.conf.urls.defaults import * +from django.conf.urls import * from django.conf import settings from django.conf.urls.static import static @@ -46,6 +46,8 @@ # /lists/ url(r'^lists/$', 'list_index', name='list_index'), url(r'^lists/new/$', 'list_new', name='list_new'), + url(r'^lists/(?P[^/]+)/members/(?P\d+)/$', + ListMembersView.as_view(), name='list_members_paged'), url(r'^lists/(?P[^/]+)/members/$', ListMembersView.as_view(), name='list_members'), url(r'^lists/(?P[^/]+)/metrics$', diff --git a/src/postorius/views/generic.py b/src/postorius/views/generic.py index fc28db1..de70228 100644 --- a/src/postorius/views/generic.py +++ b/src/postorius/views/generic.py @@ -35,7 +35,7 @@ Sets self.mailing_list to list object if fqdn_listname in **kwargs. """ - def _get_list(self, fqdn_listname): + def _get_list(self, fqdn_listname, page): return List.objects.get_or_404(fqdn_listname=fqdn_listname) def _is_list_owner(self, user, mailing_list): @@ -56,7 +56,8 @@ # get the list object. if 'fqdn_listname' in kwargs: try: - self.mailing_list = self._get_list(kwargs['fqdn_listname']) + self.mailing_list = self._get_list(kwargs['fqdn_listname'], + int(kwargs.get('page', 1))) except MailmanApiError: return utils.render_api_error(request) request.user.is_list_owner = self._is_list_owner( diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 6b39495..ba7bcce 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -39,8 +39,17 @@ """Display all members of a given list. """ + def _get_list(self, fqdn_listname, page): + m_list = super(ListMembersView, self)._get_list(fqdn_listname, page) + m_list.member_page = m_list.get_member_page(25, page) + m_list.member_page_nr = page + m_list.member_page_previous_nr = page - 1 + m_list.member_page_next_nr = page + 1 + m_list.member_page_show_next = len(m_list.member_page) >= 25 + return m_list + @method_decorator(list_owner_required) - def post(self, request, fqdn_listname): + def post(self, request, fqdn_listname, page=1): if 'owner_email' in request.POST: owner_form = NewOwnerForm(request.POST) if owner_form.is_valid(): @@ -74,7 +83,7 @@ context_instance=RequestContext(request)) @method_decorator(list_owner_required) - def get(self, request, fqdn_listname): + def get(self, request, fqdn_listname, page=1): owner_form = NewOwnerForm() moderator_form = NewModeratorForm() return render_to_response('postorius/lists/members.html', @@ -184,7 +193,7 @@ messages.error(request, e) return redirect('mass_subscribe', self.mailing_list.fqdn_listname) -def _get_choosable_domains(): +def _get_choosable_domains(request): try: domains = Domain.objects.all() except MailmanApiError: @@ -209,7 +218,7 @@ """ mailing_list = None if request.method == 'POST': - choosable_domains = _get_choosable_domains() + choosable_domains = _get_choosable_domains(request) form = ListNew(choosable_domains, request.POST) if form.is_valid(): #grab domain @@ -237,7 +246,7 @@ else: messages.success(_("New List created")) else: - choosable_domains = _get_choosable_domains() + choosable_domains = _get_choosable_domains(request) form = ListNew(choosable_domains, initial={'list_owner': request.user.email}) return render_to_response(template, {'form': form}, @@ -256,7 +265,7 @@ lists = List.objects.all(only_public=only_public) except MailmanApiError: return utils.render_api_error(request) - choosable_domains = _get_choosable_domains() + choosable_domains = _get_choosable_domains(request) if request.method == 'POST': return redirect("list_summary", fqdn_listname=request.POST["list"]) else: