Pavan Koli has proposed merging lp:~pskoli93/postorius/Add-a-single-member into
lp:postorius.
Requested reviews:
Mailman Coders (mailman-coders)
Related bugs:
Bug #1444699 in Postorius: "I can't add a single member (non-owner,
non-moderator) from the Members page."
https://bugs.launchpad.net/postorius/+bug/1444699
For more details, see:
https://code.launchpad.net/~pskoli93/postorius/Add-a-single-member/+merge/256440
Option to add a single member from the members page has been included in this
branch.
--
Your team Mailman Coders is requested to review the proposed merge of
lp:~pskoli93/postorius/Add-a-single-member into lp:postorius.
=== modified file 'src/postorius/forms.py'
--- src/postorius/forms.py 2015-04-16 01:18:49 +0000
+++ src/postorius/forms.py 2015-04-16 08:05:38 +0000
@@ -91,6 +91,14 @@
'required': _('Please enter an email adddress.'),
'invalid': _('Please enter a valid email adddress.')})
+class NewSubscriberForm(forms.Form):
+
+ """Add a subscriber."""
+ subscriber_email = forms.EmailField(
+ label=_('Email Address'),
+ error_messages={
+ 'required': _('Please enter an email adddress.'),
+ 'invalid': _('Please enter a valid email adddress.')})
class ListNew(FieldsetForm):
=== modified file 'src/postorius/templates/postorius/lists/members.html'
--- src/postorius/templates/postorius/lists/members.html 2015-04-15 21:48:46 +0000
+++ src/postorius/templates/postorius/lists/members.html 2015-04-16 08:05:38 +0000
@@ -65,6 +65,17 @@
</table>
<h2>{% trans "Members" %}</h2>
+ <form action="{% url 'list_members' list.fqdn_listname %}" method="POST" class="form-inline">{% csrf_token %}
+ <label for="bla">{% trans 'Email Address' %}</label>
+ {{ subscriber_form.subscriber_email }}
+ <button type="submit" class="btn">{% trans 'Add Member' %}</button>
+ </form>
+ <thead>
+ <tr>
+ <th>{% trans 'Address' %}</th>
+ <th> </th>
+ </tr>
+ </thead>
<table class="table table-bordered table-striped">
<thead>
<tr>
=== modified file 'src/postorius/views/list.py'
--- src/postorius/views/list.py 2015-04-15 23:44:05 +0000
+++ src/postorius/views/list.py 2015-04-16 08:05:38 +0000
@@ -77,22 +77,38 @@
% request.POST['moderator_email']))
except HTTPError as e:
messages.error(request, _(e.msg))
+ if 'subscriber_email' in request.POST:
+ subscriber_form = NewSubscriberForm(request.POST)
+ if subscriber_form.is_valid():
+ try:
+ self.mailing_list.subscribe(
+ subscriber_form.cleaned_data['subscriber_email'])
+ messages.success(
+ request, _('%s has been subscribed.'
+ % request.POST['subscriber_email']))
+ except HTTPError as e:
+ messages.error(request,_(e.msg))
+ return redirect('list_members', self.mailing_list.list_id)
owner_form = NewOwnerForm()
moderator_form = NewModeratorForm()
+ subscriber_form = NewSubscriberForm()
return render_to_response('postorius/lists/members.html',
{'list': self.mailing_list,
'owner_form': owner_form,
- 'moderator_form': moderator_form},
+ 'moderator_form': moderator_form,
+ 'subscriber_form': subscriber_form},
context_instance=RequestContext(request))
@method_decorator(list_owner_required)
def get(self, request, list_id, page=1):
owner_form = NewOwnerForm()
moderator_form = NewModeratorForm()
+ subscriber_form = NewSubscriberForm()
return render_to_response('postorius/lists/members.html',
{'list': self.mailing_list,
'owner_form': owner_form,
- 'moderator_form': moderator_form},
+ 'moderator_form': moderator_form,
+ 'subscriber_form': subscriber_form},
context_instance=RequestContext(request))
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders