tessl install tessl/pypi-flask-wtf@1.2.0Form rendering, validation, and CSRF protection for Flask with WTForms.
Agent Success
Agent success rate when using this tile
72%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.91x
Baseline
Agent success rate without this tile
79%
Build a Flask API endpoint that handles user registration with profile data and avatar upload. The endpoint should accept both form data and file uploads in a single request.
Create a POST endpoint /api/register that:
The endpoint should handle:
@generates
Success response (200 OK):
{
"message": "User registered successfully",
"username": "john_doe"
}Validation error response (400 Bad Request):
{
"error": "Validation failed"
}/api/register with valid form data (username, email, password, bio) and a valid PNG avatar file returns 200 with success message @test/api/register with valid form data but missing required field (e.g., no email) returns 400 with error message @test/api/register with valid form data and an invalid file type (e.g., .txt file) returns 400 with error message @test/api/register with valid form data but no avatar file returns 200 with success message (avatar is optional) @testProvides form handling and validation for Flask applications, including support for file uploads and CSRF protection.