-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using async_validate_{field} with Form's prefix #15
Comments
* Added support for form prefixes (#15) * Fixed type hint issue in CSRFProtectMiddleware (#17) * Fixed deprecation warnings in tests * Updated README to latest dev best practices * Fixed bugs in examples, added READMEs and requirements.txt files --------- Co-authored-by: Le Tuan Hai <letuanhai@live.com>
Sorry, I missed this earlier! This is fixed in the latest version (0.4.4). Thanks the bug report! |
Hi, just got an exception: KeyError: 'registers-registers-public'
at .<listcomp> ( /layers/google.python.pip/pip/lib/python3.11/site-packages/starlette_wtf/form.py:155 )
at .validate ( /layers/google.python.pip/pip/lib/python3.11/site-packages/starlette_wtf/form.py:155 )` |
How is prefix being invoked? Can you share the code triggering the error? |
form = await Step2regs.from_formdata(
request,
meta={
"tournament": tournament,
"user": admin,
},
prefix="registers",
)
if await form.validate():
... |
Thanks, can you share the form class definition and the template as well? There’s a unit test that has a similar setup to your code snippet so just based on this snippet I’m not sure where the second prefix is coming from. |
you're prepending the form's prefix in
while |
Got it, thanks. Try v0.4.5rc1 and let me know if that fixes the problem: pip install starlette-wtf==0.4.5rc1 |
That seems to work, thanks! |
Awesome! Thanks again for the suggestion! I bumped the version number (0.4.5) and published it to pypi. Let me know if you run into any more problems. |
raises the following exception:
caused by using
field.name
that contains Form's prefix: https://github.com/muicss/starlette-wtf/blob/f96ab6f33a7ffcb576663f996dbb401ab44f3d78/starlette_wtf/form.py#L143The text was updated successfully, but these errors were encountered: