diff --git a/ietf/mailinglists/forms.py b/ietf/mailinglists/forms.py
index a1d5ad32a..812a92242 100644
--- a/ietf/mailinglists/forms.py
+++ b/ietf/mailinglists/forms.py
@@ -67,7 +67,6 @@ class ListReqStep1(forms.Form):
return self.clean_data['list_to_close']
# multiwidget for separate scheme and rest for urls
-# todo: can the clean return the "smart" value?
class UrlMultiWidget(forms.MultiWidget):
def decompress(self, value):
if value:
@@ -88,6 +87,17 @@ class UrlMultiWidget(forms.MultiWidget):
def format_output(self, rendered_widgets):
return u'%s\n%s\n
' % ( u'
\n'.join(["%s" % w for w in rendered_widgets[0]]), rendered_widgets[1] )
+ # If we have two widgets, return the concatenation of the values
+ # (Except, if _0 is "n/a" then return an empty string)
+ # Otherwise, just return the value.
+ def value_from_datadict(self, data, name):
+ try:
+ scheme = data[name + '_0']
+ if scheme == 'n/a':
+ return ''
+ return scheme + data[name + '_1']
+ except KeyError:
+ return data[name]
class PickApprover(forms.Form):
"""
diff --git a/ietf/mailinglists/models.py b/ietf/mailinglists/models.py
index 136abd0d9..f3007c6fc 100644
--- a/ietf/mailinglists/models.py
+++ b/ietf/mailinglists/models.py
@@ -77,20 +77,20 @@ class MailingList(models.Model):
class NonWgMailingList(models.Model):
id = models.CharField(primary_key=True, maxlength=35)
+ s_name = models.CharField("Submitter's Name", blank=True, maxlength=255)
+ s_email = models.EmailField("Submitter's Email Address", blank=True, maxlength=255)
+ list_name = models.CharField("Mailing List Name", unique=True, maxlength=255)
+ list_url = models.CharField("List URL", maxlength=255)
+ admin = models.TextField("Administrator(s)' Email Address(es)", blank=True)
purpose = models.TextField(blank=True)
area = models.ForeignKey(Areas, db_column='area_acronym_id')
- admin = models.TextField("Administrator(s)' Email Address(es)", blank=True)
- list_url = models.CharField("List URL", maxlength=255)
- s_name = models.CharField("Submitter's Name", blank=True, maxlength=255)
- s_email = models.CharField("Submitter's Email Address", blank=True, maxlength=255)
+ subscribe_url = models.CharField("Subscribe URL", blank=True, maxlength=255)
+ subscribe_other = models.TextField("Subscribe Other", blank=True)
# Can be 0, 1, -1, or what looks like a person_or_org_tag, positive or neg.
# The values less than 1 don't get displayed on the list of lists.
status = models.IntegerField()
- list_name = models.CharField("Mailing List Name", unique=True, maxlength=255)
- subscribe_url = models.CharField("Subscribe URL", blank=True, maxlength=255)
- subscribe_other = models.TextField("Subscribe Other", blank=True)
ds_name = models.CharField(blank=True, maxlength=255)
- ds_email = models.CharField(blank=True, maxlength=255)
+ ds_email = models.EmailField(blank=True, maxlength=255)
msg_to_ad = models.TextField(blank=True)
def __str__(self):
return self.list_name
diff --git a/ietf/mailinglists/views.py b/ietf/mailinglists/views.py
index df8faddc1..edaf16db3 100644
--- a/ietf/mailinglists/views.py
+++ b/ietf/mailinglists/views.py
@@ -13,12 +13,25 @@ nonwg_fields = {
'msg_to_ad': None,
}
-nonwg_widgets = {
- 'list_url': UrlMultiWidget(choices=(('http://', 'http://'), ('https://', 'https://'), ('mailto:', 'mailto:'))),
- 'subscribe_url': UrlMultiWidget(choices=(('n/a', 'Not Applicable'), ('http://', 'http://'), ('https://', 'https://'))),
+nonwg_attrs = {
+ 's_name': {'size': 50},
+ 's_email': {'size': 50},
+ 'list_name': {'size': 80},
}
-nonwg_callback = form_decorator(fields=nonwg_fields, widgets=nonwg_widgets)
+nonwg_widgets = {
+ 'list_url': UrlMultiWidget(choices=(('http://', 'http://'), ('https://', 'https://'), ('mailto:', 'mailto:'))),
+ 'admin': forms.Textarea(attrs = {'rows': 3, 'cols': 50}),
+ 'purpose': forms.Textarea(attrs = {'rows': 4, 'cols': 70}),
+ 'subscribe_url': UrlMultiWidget(choices=(('n/a', 'Not Applicable'), ('http://', 'http://'), ('https://', 'https://'))),
+ 'subscribe_other': forms.Textarea(attrs = {'rows': 3, 'cols': 50}),
+}
+
+nonwg_querysets = {
+ 'area': Areas.objects.filter(status=1)
+}
+
+nonwg_callback = form_decorator(fields=nonwg_fields, widgets=nonwg_widgets, attrs=nonwg_attrs, querysets=nonwg_querysets)
def gen_approval(approvers, parent):
class BoundApproval(parent):
@@ -28,13 +41,22 @@ def gen_approval(approvers, parent):
return BoundApproval
class NonWgWizard(wizard.Wizard):
+ form0 = None
def get_template(self):
- return "mailinglists/nwg_wizard.html"
- def hash_failed(self, step):
+ templates = []
+ if self.form0:
+ action = {'add': 'addedit', 'edit': 'addedit', 'delete': 'delete'}[self.form0.clean_data['add_edit']]
+ templates.append("mailinglists/nwg_wizard_%s_step%d.html" % (action, self.step))
+ templates.append("mailinglists/nwg_wizard_%s.html" % (action))
+ templates.append("mailinglists/nwg_wizard_step%d.html" % (self.step))
+ templates.append("mailinglists/nwg_wizard.html")
+ return templates
+ def failed_hash(self, step):
raise NotImplementedError("step %d hash failed" % step)
def process_step(self, request, form, step):
form.full_clean()
if step == 0:
+ self.form0 = form
if form.clean_data['add_edit'] == 'add':
self.form_list.append(forms.form_for_model(NonWgMailingList, formfield_callback=nonwg_callback))
elif form.clean_data['add_edit'] == 'edit':
@@ -45,6 +67,7 @@ class NonWgWizard(wizard.Wizard):
if step == 1:
form0 = self.get_form(0, request.POST)
form0.full_clean()
+ self.form0 = form0
add_edit = form0.clean_data['add_edit']
if add_edit == 'add' or add_edit == 'edit':
self.form_list.append(gen_approval([ad.person_id for ad in Areas.objects.get(area_acronym=form.clean_data['area']).areadirectors_set.all()], PickApprover))
@@ -57,8 +80,7 @@ def non_wg_wizard(request):
class ListReqWizard(wizard.Wizard):
def get_template(self):
return "mailinglists/nwg_wizard.html"
- def hash_failed(self, step):
- raise NotImplementedError("step %d hash failed" % step)
+ # want to implement parse_params to get domain for list
def process_step(self, request, form, step):
form.full_clean()
super(ListReqWizard, self).process_step(request, form, step)
diff --git a/ietf/templates/mailinglists/nwg_wizard.html b/ietf/templates/mailinglists/nwg_wizard.html
index 89b352182..fd0585254 100644
--- a/ietf/templates/mailinglists/nwg_wizard.html
+++ b/ietf/templates/mailinglists/nwg_wizard.html
@@ -1,10 +1,6 @@
-{% extends "base.html" %}
+{% extends "mailinglists/nwg_wizard_base.html" %}
-{% block css %}
-ul.errorlist { color: red; border: 1px solid red; }
-{% endblock %}
-
-{% block content %}
+{% block nwgcontent %}
++ +{% endblock %} diff --git a/ietf/templates/mailinglists/nwg_wizard_step0.html b/ietf/templates/mailinglists/nwg_wizard_step0.html new file mode 100644 index 000000000..a643e7d6c --- /dev/null +++ b/ietf/templates/mailinglists/nwg_wizard_step0.html @@ -0,0 +1,19 @@ +{% extends "mailinglists/nwg_wizard_base.html" %} + +{% block nwgcontent %} +
++ +
+{% block nwgcontent %} +form goes here +{% endblock %} +
+