User object returns None in ManytoMany
<p>I have a many to many relationship between the User object and Movement object. Everytime I run the test to see of the User object was successfully added, I get a auth.User.None</p>

<p>Models:</p>

<pre><code>class Movement(models.Model):
    zipcode = models.ForeignKey('ZipCode')
    title = models.CharField(max_length=100)
    description = models.CharField(max_length=400, null=False, 
        blank=True)
    users = models.ManyToManyField(User)
    slug = models.SlugField(unique=True)


    def save(self, *args, **kwargs):
        self.slug = slugify(self.title)
        super(Movement, self).save(*args, **kwargs)

    def __str__(self):
        return self.title
</code></pre>

<p>Form:</p>

<pre><code>class MovementForm(forms.ModelForm):  

    title= forms.CharField(max_length=100, help_text="Movement title")
    description = forms.CharField(help_text="Movement description",
        widget=forms.Textarea(attrs={'paceholder':'Please enter your description'}))
    slug = forms.CharField(widget=forms.HiddenInput(), required=False)

    class Meta:
        model = Movement
        exclude = ['zipcode', 'users']
</code></pre>

<p>View:</p>

<pre><code>@login_required
def new_movement(request):
    template = 'new_movement.html'


    if request.method == 'POST':
        zipcode_form = ZipCodeForm(data=request.POST)
        movement_form = MovementForm(data=request.POST)

        if zipcode_form.is_valid() and movement_form.is_valid():
            zipcode, create = ZipCode.objects.get_or_create(**zipcode_form.cleaned_data)
            movement = movement_form.save(commit=False)
            movement.zipcode = zipcode
            movement.save()
            movement.users.add(request.user)
            movement.save()
            return redirect('/%s/results' %zipcode.zipcode)
    else:

        zipcode_form = ZipCodeForm()
        movement_form = MovementForm()

    return render(request, template, 
        {'movement_form':movement_form, 'zipcode_form':zipcode_form})

    return render(request, template, {} )
</code></pre>

<p>Everything runs fine, but when I run my test code hoping to get the name of the User, all I get is auth.User.None.</p>

<p>test.py:</p>

<pre><code>class NewMovementViewTest(TestCase):

    def setUp(self):
        self.user = User.objects.create_user(
            username='Megan',
            email='megan@email.com',
            password='password',
        )
        self.client.login(username='Megan', password='password')

    def test_new_movement_saves_user(self):

        response = self.client.post('/new_movement/',
            data={'title':'A movement',
            'zipcode':20016,
            'description':'Some movement'})
        movements = Movement.objects.all()
        self.assertEqual(movements.count(), 1)
        movement= movements[0]
        self.assertEqual(movement.title, 'A movement')
        self.assertEqual(movement.zipcode.zipcode, 20016)
        self.assertEqual(movement.description, 'Some movement')
        users = Movement.objects.filter(users__username__startswith="Megan")
        print(users[0].users)
</code></pre>

<p>Test Output:</p>

<pre><code>Creating test database for alias 'default'...
auth.User.None
.
----------------------------------------------------------------------
Ran 1 test in 0.191s

OK
</code></pre>