File upload handler in Comments framework
|Reported by:||sebzur||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||yes||Patch needs improvement:||no|
I've recently find out some annoying django.contrib.comments limitations-chain. It came out after unsuccessful custom comment form (that included FileField) submission.
This is what I mean by limitations-chain:
I could not use comment model having file field (CommentSeciurityForm does not use *args, kwargs when supering forms.Form and thus files=request.FILES was not valid init kword argument in forms that base on CommentSeciurityForm)
In consequence comment form post handler (view function named 'post_comment') is not using request.FILES
Which is related with form template issue: check for form.is_multipart is missing (hence multipart/form-data enctype is not set)
Are those file-handling limitation intentionally created (some security reasons?)? I'm attaching a .diff with some cosmetic changes, that allow for files upload.
While browsing django.contrib.comments code and using the framework in my project I can see there's still some work to be done (there's plenty of room for some generalizations - I found API being nice, however we could make it more flexible with e.g. allowing more than one comment form definition).
However, to stay focused on one issue: could You please comment this problem (or not) with files?
Change History (10)
Changed 6 years ago by sebzur
comment:1 Changed 6 years ago by Alex
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:5 Changed 4 years ago by julien
- Needs documentation set
- Needs tests set
- Type changed from Bug to New feature