Answers for "change value of request post in django view form.save"

1

passing user instance django form submission

if form.is_valid():
    post = form.save(commit=False)
    post.author = request.user
    post.published_date = timezone.now()
    post.save()
Posted by: Guest on December-20-2020

Code answers related to "change value of request post in django view form.save"

Python Answers by Framework

Browse Popular Code Answers by Language