flask-wtf
flask-wtf copied to clipboard
Add support for multiple file validation
Add MultipleFileField, FilesRequired, FilesAllowed to support multiple files validation.
Closes #337
Codecov Report
Merging #338 into master will increase coverage by
0.02%. The diff coverage is100%.
@@ Coverage Diff @@
## master #338 +/- ##
==========================================
+ Coverage 99.67% 99.69% +0.02%
==========================================
Files 18 18
Lines 911 986 +75
Branches 74 82 +8
==========================================
+ Hits 908 983 +75
Misses 3 3
| Impacted Files | Coverage Δ | |
|---|---|---|
| tests/test_file.py | 100% <100%> (ø) |
:arrow_up: |
| flask_wtf/file.py | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 73e8c58...7188dd9. Read the comment docs.
I experimented with this back when I made the WTForms PR, I'm trying to remember the design decisions I made.
I think that while the fields were separate so it was clear what was intended, I was trying to make the validators work for both single and multiple files (rather than adding extra validators or a multiple=True flag). Do you or @lepture agree with that?
Also might be interesting to add a test of the Length validator on the multiple field.
Sounds good to me.
I'd love to see this merged. Anything I can help with?
Codecov Report
Merging #338 into master will decrease coverage by
1.33%. The diff coverage is81.01%.
@@ Coverage Diff @@
## master #338 +/- ##
==========================================
- Coverage 97.97% 96.63% -1.34%
==========================================
Files 18 18
Lines 936 1011 +75
Branches 73 81 +8
==========================================
+ Hits 917 977 +60
- Misses 17 31 +14
- Partials 2 3 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| tests/test_file.py | 78.18% <76.00%> (-2.78%) |
:arrow_down: |
| flask_wtf/file.py | 90.62% <89.65%> (-1.05%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update d41f3bc...beb8623. Read the comment docs.
Any chance of this being merged? :)
Any chance of this being merged? :)
Hoping the same. @azmeuk can you review this please?
This PR may not be merged.
I was planning to implement what David recommended as an alternative to this PR in January, but I was too busy with work. Maybe I will have time to make another PR next month. BTW, I'm also happy to review a PR!
Hi guys, I finally re-implemented this in #556. With the new PR, the FileRequired, FileAllowed, and FileSize can be used for both single or multiple files.