-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add file/image field #127
base: master
Are you sure you want to change the base?
Add file/image field #127
Conversation
typesystem/fields.py
Outdated
@@ -1,4 +1,6 @@ | |||
import decimal | |||
import imghdr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated since 3.11.
https://peps.python.org/pep-0594/#imghdr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typesystem support version <= 3.10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.11 releases just in one week. The typesystem will support it without any doubt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional dependency lib is not cost-effective. Or do not check the image type.
such as : filetype
OR puremagic
in pypi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be an optional dependency for those, who wants to use File fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Image
is unnecessary. Just define the File
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if File()
can validate the file type. So we can specify that we want image, audio, video, etc.
Something like
File(accept=['image/jpeg', 'image/png'])
This should answer your question. But IMO, a dedicated Image()
field is a nice utility.
Please update |
File
field #115Image
field #116 file field@aminalaee , docs build failed.