![](https://secure.gravatar.com/avatar/1786350e8a814c84a91563c7c11e4000.jpg?s=120&d=mm&r=g)
On 27 February 2015 at 20:39, Pranjal Yadav <godricglow@gmail.com> wrote:
Hi Abhilash,
Thanks for your help. I read that we need to define methods as clean_<fieldname> however I missed I was cleaning multiple fields. For the listname method it works the way you told me but I tried something similar ( http://pastebin.com/p40A19hU ) and it didn't work. If you could tell me why is that?
The list that you pass in choices is a list of 'tuples' which has 2 elements in it. The first is the choice to be displayed in the 'dropdown' and second is its value.
So you have to do something like this:
self.domain_choices =
[('mailman.most-desirable.org','mailman.most-desirable.org')]
and then call the ListNew class like this:
form = ListNew(self.domain_choices, self.form_data)
Also I'm still puzzled when I run tox -e py27-django1.7 -- postorius.tests.test_forms.UserNewTest tox -e py27-django1.7 -- postorius.tests.test_forms.ListNewTest tox -e py27-django1.7 -- postorius.tests.test_forms.DomainNewTest
Its not the correct way to run the individual test cases in django, it is little different from nose. You can run
$ tox -e py27-django1.7 -- postorius.test.test_forms:ListNewTest
-- thanks, Abhilash Raj