1313 'msg_to_ad' : None ,
1414}
1515
16+ nonwg_attrs = {
17+ 's_name' : {'size' : 50 },
18+ 's_email' : {'size' : 50 },
19+ 'list_name' : {'size' : 80 },
20+ }
21+
1622nonwg_widgets = {
1723 'list_url' : UrlMultiWidget (choices = (('http://' , 'http://' ), ('https://' , 'https://' ), ('mailto:' , 'mailto:' ))),
24+ 'admin' : forms .Textarea (attrs = {'rows' : 3 , 'cols' : 50 }),
25+ 'purpose' : forms .Textarea (attrs = {'rows' : 4 , 'cols' : 70 }),
1826 'subscribe_url' : UrlMultiWidget (choices = (('n/a' , 'Not Applicable' ), ('http://' , 'http://' ), ('https://' , 'https://' ))),
27+ 'subscribe_other' : forms .Textarea (attrs = {'rows' : 3 , 'cols' : 50 }),
28+ }
29+
30+ nonwg_querysets = {
31+ 'area' : Areas .objects .filter (status = 1 )
1932}
2033
21- nonwg_callback = form_decorator (fields = nonwg_fields , widgets = nonwg_widgets )
34+ nonwg_callback = form_decorator (fields = nonwg_fields , widgets = nonwg_widgets , attrs = nonwg_attrs , querysets = nonwg_querysets )
2235
2336def gen_approval (approvers , parent ):
2437 class BoundApproval (parent ):
@@ -28,13 +41,22 @@ def __init__(self, *args, **kwargs):
2841 return BoundApproval
2942
3043class NonWgWizard (wizard .Wizard ):
44+ form0 = None
3145 def get_template (self ):
32- return "mailinglists/nwg_wizard.html"
33- def hash_failed (self , step ):
46+ templates = []
47+ if self .form0 :
48+ action = {'add' : 'addedit' , 'edit' : 'addedit' , 'delete' : 'delete' }[self .form0 .clean_data ['add_edit' ]]
49+ templates .append ("mailinglists/nwg_wizard_%s_step%d.html" % (action , self .step ))
50+ templates .append ("mailinglists/nwg_wizard_%s.html" % (action ))
51+ templates .append ("mailinglists/nwg_wizard_step%d.html" % (self .step ))
52+ templates .append ("mailinglists/nwg_wizard.html" )
53+ return templates
54+ def failed_hash (self , step ):
3455 raise NotImplementedError ("step %d hash failed" % step )
3556 def process_step (self , request , form , step ):
3657 form .full_clean ()
3758 if step == 0 :
59+ self .form0 = form
3860 if form .clean_data ['add_edit' ] == 'add' :
3961 self .form_list .append (forms .form_for_model (NonWgMailingList , formfield_callback = nonwg_callback ))
4062 elif form .clean_data ['add_edit' ] == 'edit' :
@@ -45,6 +67,7 @@ def process_step(self, request, form, step):
4567 if step == 1 :
4668 form0 = self .get_form (0 , request .POST )
4769 form0 .full_clean ()
70+ self .form0 = form0
4871 add_edit = form0 .clean_data ['add_edit' ]
4972 if add_edit == 'add' or add_edit == 'edit' :
5073 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):
5780class ListReqWizard (wizard .Wizard ):
5881 def get_template (self ):
5982 return "mailinglists/nwg_wizard.html"
60- def hash_failed (self , step ):
61- raise NotImplementedError ("step %d hash failed" % step )
83+ # want to implement parse_params to get domain for list
6284 def process_step (self , request , form , step ):
6385 form .full_clean ()
6486 super (ListReqWizard , self ).process_step (request , form , step )
0 commit comments