diff --git a/forms.py b/forms.py index 279c7ef..bdfe62c 100644 --- a/forms.py +++ b/forms.py @@ -156,6 +156,7 @@ label = _('ID'), initial = 9, widget = forms.HiddenInput(), + required = False, error_messages = { 'invalid': _('Please provide an integer ID.') } diff --git a/mailman_rest_client.py b/mailman_rest_client.py index 791f168..9a56a04 100644 --- a/mailman_rest_client.py +++ b/mailman_rest_client.py @@ -263,6 +263,12 @@ return sorted(response['entries'], key=itemgetter('self_link')) + def update_list(self, data): + """Update the settings for a list. + """ + return self._http_request('/3.0/lists/' + self.info['fqdn_listname'], data, 'PATCH') + def __str__(self): - """A string representation of a list.""" + """A string representation of a list. + """ return "A list object for the list '%s'." % self.info['fqdn_listname'] diff --git a/mockdata.py b/mockdata.py index 658cd00..b046dcc 100644 --- a/mockdata.py +++ b/mockdata.py @@ -94,7 +94,7 @@ #self.info['real_name'] = 'Real name lorem ipsum dolor sit' self.info['reject_these_nonmembers'] = 'Reject these non members (BLOB format) lorem ipsum dolor sit' self.info['reply_goes_to_list'] = 'Reply goes to list lorem ipsum dolor sit' - self.info['reply_to_address'] = 'Reply to address lorem ipsum dolor sit' + self.info['reply_to_address'] = 'some_reply_to_address@lorem.ipsum' self.info['require_explicit_destination'] = True self.info['respond_to_post_requests'] = True self.info['scrub_nondigest'] = True diff --git a/templates/mailman-django/lists/settings.html b/templates/mailman-django/lists/settings.html index c8ec0e4..eac75e0 100644 --- a/templates/mailman-django/lists/settings.html +++ b/templates/mailman-django/lists/settings.html @@ -7,10 +7,18 @@

This page visualizes all list settings. Currently the page is not connected to the rest server so the settings will not be saved when changing them. However, this gives an idea of what the settings page could look like.

+{% if message %} +

{{ message }}

+{% endif %} + +
+ {{ form.as_div }}
+
+ {% endblock %} diff --git a/views.py b/views.py index 4948626..80abfcb 100644 --- a/views.py +++ b/views.py @@ -148,9 +148,11 @@ if request.method == 'POST': form = ListSettings(request.POST) if form.is_valid(): - pass - # code to update the form etc., will use PATCH/PUT etc. + the_list.update_list(request.POST) + message = "The list has been updated." else: - # should later use GET to get all the info about the list form = ListSettings(the_list.info) - return render_to_response(template, {'form': form}) + message = "" + return render_to_response(template, {'form': form, + 'message': message, + 'fqdn_listname': the_list.info['fqdn_listname']})