Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add file/image field #127

wants to merge 6 commits into from

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
Copy link
Member

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

Copy link
Member

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

Copy link
Member

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?

Copy link
Member

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
Member

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants