diff --git a/src/postorius/templates/postorius/lists/members.html b/src/postorius/templates/postorius/lists/members.html index e553ae8..f4bef91 100644 --- a/src/postorius/templates/postorius/lists/members.html +++ b/src/postorius/templates/postorius/lists/members.html @@ -21,48 +21,48 @@ {{ member_form.email.label_tag }} {{ member_form.email|add_form_control }} - + {% endif %} {% if role == 'subscriber' %} -
-
-
-
- - - - -
-
-
-
- - {% trans 'CSV Export' %} - -
+ {% if form.choices.errors %} +
{{ form.choices.errors }}
+ {% endif %} +
+
+
+ + + + +
+
{% endif %} {% if members|length > 0 %} -
+ {% if role == 'subscriber' %} + {% csrf_token %} - {% if form.choices.errors %} -
{{ form.choices.errors }}
- {% endif %} -
+ + + {% endif %} +
- {% if role == 'subscriber' %} - - {% endif %} - - @@ -70,9 +70,15 @@ {% for member in members %} {% if role == 'subscriber' %} - - - + + {% else %} @@ -82,11 +88,8 @@
{% trans 'Address' %} + {% if role == 'subscriber' %} - + {% endif %} + {% trans 'Address' %}
{{ member.email }}{% trans 'Unsubscribe' %} + + + {% trans 'Member Options' %} + {{ member }} {% trans 'Delete' %}
- {% if role == 'subscriber' %} - + {% include 'postorius/lib/pagination.html' with page=members %} {% endif %} {% else %} diff --git a/src/postorius/templates/postorius/lists/summary.html b/src/postorius/templates/postorius/lists/summary.html index 5ddfa51..4aa827c 100644 --- a/src/postorius/templates/postorius/lists/summary.html +++ b/src/postorius/templates/postorius/lists/summary.html @@ -39,9 +39,11 @@

{% endblocktrans %}

- - {% trans 'Unsubscribe' %} {{ subscribed_address }} - +

+ {% csrf_token %} + + +

{% else %}

{% trans 'Subscribe to this list' %}

diff --git a/src/postorius/urls.py b/src/postorius/urls.py index b22c656..5d2e0c1 100644 --- a/src/postorius/urls.py +++ b/src/postorius/urls.py @@ -34,8 +34,7 @@ url(r'^subscribe$', list_views.ListSubscribeView.as_view(), name='list_subscribe'), url(r'^change_subscription$', list_views.ChangeSubscriptionView.as_view(), name='change_subscription'), - url(r'^unsubscribe/(?P[^/]+)$', list_views.ListUnsubscribeView.as_view(), - name='list_unsubscribe'), + url(r'^unsubscribe/$', list_views.ListUnsubscribeView.as_view(), name='list_unsubscribe'), url(r'^subscription_requests$', list_views.list_subscription_requests, name='list_subscription_requests'), url(r'^handle_subscription_request/(?P[^/]+)/(?P[accept|reject|discard|defer]+)$', diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index b325630..5c7ff62 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -94,6 +94,7 @@ paginator_class=utils.MailmanPaginator) context['empty_error'] = _('List has no Subscribers') context['count_options'] = [25, 50, 100, 200] + context['form'] = form else: context['member_form'] = member_form if role == 'owner': @@ -272,8 +273,8 @@ """Unsubscribe from a mailing list.""" @method_decorator(login_required) - def get(self, request, *args, **kwargs): - email = kwargs['email'] + def post(self, request, *args, **kwargs): + email = request.POST['email'] try: self.mailing_list.unsubscribe(email) messages.success(request, _('%s has been unsubscribed from this list.') % email) @@ -307,9 +308,9 @@ messages.error(request, _('The email address %s is not valid.') % email) else: form = ListMassSubscription() - return render_to_response('postorius/lists/mass_subscribe.html', - {'form': form, 'list': mailing_list}, - context_instance=RequestContext(request)) + return render(request, 'postorius/lists/mass_subscribe.html', + {'form': form, 'list': mailing_list}, + context_instance=RequestContext(request)) class ListMassRemovalView(MailingListView): @@ -320,9 +321,9 @@ @method_decorator(list_owner_required) def get(self, request, *args, **kwargs): form = ListMassRemoval() - return render_to_response('postorius/lists/mass_removal.html', - {'form': form, 'list': self.mailing_list}, - context_instance=RequestContext(request)) + return render(request, 'postorius/lists/mass_removal.html', + {'form': form, 'list': self.mailing_list}, + context_instance=RequestContext(request)) @method_decorator(list_owner_required) def post(self, request, *args, **kwargs):