FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add file/image field by ponytailer · Pull Request #127 · encode/typesystem · GitHub

This repository was archived by the owner on Aug 19, 2025. It is now read-only.
/ typesystem Public archive

Add file/image field - #127

Open
ponytailer wants to merge 6 commits into
encode:masterfrom
ponytailer:master
Open

Add file/image field#127
ponytailer wants to merge 6 commits into
encode:masterfrom
ponytailer:master

Conversation

ponytailer commented Mar 3, 2022
edited
Loading

Copy link
Copy Markdown
Contributor

This was referenced Mar 3, 2022
Comment thread typesystem/fields.py Outdated
@@ -1,4 +1,6 @@
import decimal
import imghdr

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

typesystem support version <= 3.10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

3.11 releases just in one week. The typesystem will support it without any doubt.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Additional dependency lib is not cost-effective. Or do not check the image type.

such as : filetype OR puremagic in pypi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This can be an optional dependency for those, who wants to use File fields.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe Image is unnecessary. Just define the File, right?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Copy link
Copy Markdown

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL