I have a django form where I need to set a value for validation purposes which is not passed in as part of the standard Post request.
In my code I currently have something like this:
if request.method == 'POST':
postform = CreatePostForm(request.POST, request.FILES, initial={'post_type':post.post_type})
if postform.is_valid():
.....
The value post_type is a selection with a value of something like 'QUE'
The issue I am having is that this does not appear to be valid. Does anyone have any suggestions on how to add the post_type value into the CreatePostForm class before the validation takes place.
Please note I do not want to expose this value on the form so including it as part of the post is not an option.