[Fixed]-How to use django-taggit from view file

1👍

Try to use save_m2m() method.

From docs:

If, when saving a form, you use the commit=False option you’ll need to
call save_m2m() on the form after you save the object, just as you
would for a form with normal many to many fields on it:

if request.method == "POST":
form = MyFormClass(request.POST)
if form.is_valid():
    obj = form.save(commit=False)
    obj.user = request.user
    obj.save()
    # Without this next line the tags won't be saved.
    form.save_m2m()

Leave a comment