if form.is_valid(): post = form.save(commit=False) post.author = request.user post.published_date = timezone.now() post.save()