[Answer]-Django – Changing/Initializing a Form Field after Validation

1👍

copy the request.POST dict, add the user and then populate the form

data = request.POST.copy()
data["author"] = request.user.username
form = YourCustomForm(data)
if form.is_valid():
     print form.cleaned_data['author']
👤levi

Leave a comment