diff --git a/src/mailman_django/forms.py b/src/mailman_django/forms.py index 404f989..0034714 100644 --- a/src/mailman_django/forms.py +++ b/src/mailman_django/forms.py @@ -142,8 +142,8 @@ mail_host = forms.ChoiceField() - def __init__(self,domain_choices, usermail="", *args, **kwargs): - super(ListNew, self).__init__(*args, **kwargs) + def __init__(self,domain_choices, *args, **kwargs): + super(ListNew, self).__init__(*args, **kwargs) self.fields["mail_host"] = forms.ChoiceField( widget = forms.Select(), label = _('Mail Host'), @@ -152,10 +152,7 @@ error_messages = {'required': _("Choose an existing Domain."), 'invalid':"ERROR-todo_forms.py" }#todo ) - self.fields["list_owner"] = forms.EmailField( - initial = usermail - ) - + def clean_listname(self): try: validate_email(self.cleaned_data['listname']+'@example.net') diff --git a/src/mailman_django/tests/tests.py b/src/mailman_django/tests/tests.py index 10ea47b..e1034f1 100644 --- a/src/mailman_django/tests/tests.py +++ b/src/mailman_django/tests/tests.py @@ -194,15 +194,13 @@ >>> "All available Lists" in response.content True -The new List creation form is opened by clicking on the Button mentioned above or accessing the page directly it should include a prefilled list owner field with the currently logged in user. +The new List creation form is opened by clicking on the Button mentioned above or accessing the page directly >>> response = c.get('/lists/new/') >>> response.status_code 200 >>> print "Create a new List on" in response.content True - >>> print "james@example.com" in response.content - True Creating a new List we do need to specify at least the below mentioned items. Those were entered using some nice GUI Forms which do only show up available Values or offer you to choose a name which will be checked during validation. We're now submitting the form using a POST request and get redirected to the List Index Page diff --git a/src/mailman_django/views.py b/src/mailman_django/views.py index fc8e226..d5bcaad 100644 --- a/src/mailman_django/views.py +++ b/src/mailman_django/views.py @@ -117,7 +117,7 @@ for domain in c.domains: choosable_domains.append((domain.mail_host, domain.mail_host)) - form = ListNew(choosable_domains,None, request.POST) + form = ListNew(choosable_domains, request.POST) if form.is_valid(): #grab domain @@ -148,7 +148,7 @@ choosable_domains = [("",_("Choose a Domain"))] for domain in c.domains: choosable_domains.append((domain.mail_host,domain.mail_host)) - form = ListNew(choosable_domains,usermail=request.user.username) + form = ListNew(choosable_domains,initial={'list_owner': request.user.username}) return render_to_response(template, {'form': form, error:None}, context_instance=RequestContext(request))