Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Conversation

ponytailer
Copy link
Contributor

@ponytailer ponytailer commented Mar 3, 2022

This was referenced Mar 3, 2022
@@ -1,4 +1,6 @@
import decimal
import imghdr

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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

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.

Copy link
Contributor Author

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

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.

Copy link
Contributor Author

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?

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.

@alex-oleshkevich
Copy link

Please update Form class. Currently, it does not know how to render that new type + HTML template for it.
See
https://github.com/encode/typesystem/blob/master/typesystem/forms.py#L15
https://github.com/encode/typesystem/blob/master/typesystem/forms.py#L122

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants