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%
A simple Flask web application that allows users to upload documents with required file validation.
@generates
from flask_wtf import FlaskForm
class DocumentUploadForm(FlaskForm):
"""
A form for uploading documents that requires a file to be present.
The form should:
- Have a field named 'document' for file uploads
- Ensure that a file is actually uploaded (not just an empty form submission)
- Use appropriate validation to enforce file presence
"""
pass
def process_upload(form):
"""
Process the upload form and return the uploaded filename if validation succeeds.
Args:
form: A DocumentUploadForm instance populated with request data
Returns:
A dictionary with either:
- {'success': True, 'filename': str} if validation passes
- {'success': False, 'error': str} if validation fails
"""
passProvides form handling, file upload fields, and file validation capabilities for Flask applications.
@satisfied-by