Hi, I’m using Unpoly which has a feature (up-validate) that submits a forms with a request header so that I could rerender my form with new information (like pre-populate some other fields).
I can, on my view, check for that header and recreate the form with the new information.
My problem is that, even if I don’t call is_valid(), on sending the form back, the form has errors.
Is there a way to avoid that validation (my guess it’s the model validation kicking in since this is the form is a ModelForm).
Update: even with a non-ModelForm, it still has errors before is_valid().
def post(self, request):
if request.is_up_validate: <---- Middleware that checks Unpoly header
some_id = request.POST.get('some_id', None)
form = SomethingForm(
request.POST,
user_id=request.user.id,
some_id=some_id
)
logger.debug (form.errors) <---- Form has errors
return render(request, 'template_name.html', {'form': form})
TIA