Fix preview by creating a MailingList object and using the
existing list_summary.html. - Legacy-Id: 272
This commit is contained in:
parent
48a4219a32
commit
f8dbed4884
|
@ -209,6 +209,8 @@ class ListReqWizard(wizard.Wizard):
|
|||
if self.step > self.main_step:
|
||||
self.extra_context['main_form'] = self.clean_forms[self.main_step]
|
||||
self.extra_context['requestor_is_approver'] = self.requestor_is_approver
|
||||
if self.step == self.main_step + 1:
|
||||
self.extra_context['list'] = self.getlist()
|
||||
return super(ListReqWizard, self).render_template(*args, **kwargs)
|
||||
# want to implement parse_params to get domain for list
|
||||
def process_step(self, request, form, step):
|
||||
|
@ -251,12 +253,15 @@ class ListReqWizard(wizard.Wizard):
|
|||
self.requestor_is_approver = True
|
||||
self.form_list.append(gen_list_approval(approvers, requestor_person, ListApprover))
|
||||
super(ListReqWizard, self).process_step(request, form, step)
|
||||
def done(self, request, form_list):
|
||||
def getlist(self):
|
||||
list = MailingList(**self.clean_forms[self.main_step].clean_data)
|
||||
list.mailing_list_id = None # make sure that we create a new row
|
||||
list.auth_person_id = int(self.clean_forms[self.main_step + 1].clean_data['approver'])
|
||||
list.mail_type = MailingList.MAILTYPE_MAP[self.clean_forms[0].clean_data['mail_type']]
|
||||
list.approved = 0
|
||||
return list
|
||||
def done(self, request, form_list):
|
||||
list = self.getlist()
|
||||
list.auth_person_id = int(self.clean_forms[self.main_step + 1].clean_data['approver'])
|
||||
list.save()
|
||||
approver_email = list.auth_person.email()
|
||||
site = Site.objects.get_current()
|
||||
|
|
|
@ -2,31 +2,12 @@
|
|||
|
||||
{% block mlform %}
|
||||
<tr>
|
||||
<th colspan=2>Preview</th>
|
||||
<td colspan=2><h3>Preview your Request</h3></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ main_form.requestor.label }}</th>
|
||||
<td>{{ main_form.requestor.field.data|escape }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ main_form.requestor_email.label }}</th>
|
||||
<td>{{ main_form.requestor_email.field.data|escape }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ main_form.mlist_name.label }}</th>
|
||||
<td>{{ main_form.mlist_name.field.data|escape }}@{{ main_form.domain_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ main_form.requestor_email.label }}</th>
|
||||
<td>{{ main_form.requestor_email.field.data|escape }}</td>
|
||||
</tr>
|
||||
<!-- make sure we have all the fields -->
|
||||
{% for field in main_form %}
|
||||
<tr>
|
||||
<th>{{ field.label }}</th>
|
||||
<td>{{ field.data|escape|linebreaksbr }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<!-- must figure out whether this is an approver or a hidden field -->
|
||||
{% include "mailinglists/list_summary.html" %}
|
||||
{% if form.approver.is_hidden %}
|
||||
<tr><td colspan=2><hr>You will be the approver for this request.{{ form.approver }}</td></tr>
|
||||
{% else %}
|
||||
{{ form }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue