[Fixed]-Set slug field form manually in views Django

1👍

So, I figure it out!
In views.py, after ” if form.is_valid():”
I put this:

prev = form.save(commit=False)
prev.id_p = thing.slug
prev.save()    

In that way I put the data in the excluded field before I commit the form.

👤covsq

Leave a comment