How do test taggit field in a form or view?

Below is some of my code. If you need more information please let me know.

models.py
```tags = TaggableManager()```
```forms.py
        fields = ['title','content','snippet','thumbnail_image','tags']
        widgets= {
            'tags' : TagWidget(attrs={'data-role':'tagsinput','placeholder':'Add Tags','class':'form-control'}),
            'title': forms.TextInput(attrs={'class':'form-control'}),
            'snippet': forms.Textarea(attrs={'class':'form-control','rows':3}),
            'thumbnail_image': forms.ClearableFileInput(attrs={'class':'form-control'})
        }```

Here is an example of what I am trying to do.
        ```res = self.client.post(BLOG_CREATE_URL,
                         {'title': 'Greatest blog ever',
                          'content': "hahahahah nicuuu!!" ,
                          'thumbnail_image': 'blog/test/gibson-vintage.jpg',
                          'snippet': 'good snippet', 'tags': ?,
                          })```
The response code should should be 302 but it shows 200. So I tested the forms and it shows form is not valid. 
I have no idea how to continue the test. I am new django. Can someone help me? Thank you in advance.

Just a side note - I see where you tried to enclose your code with the “fence posts” (```). But those markers need to be on lines by themselves. What you want to do is more something like this:
```

def function(self):
    return self

```

1 Like

Thank you. Will do that.