Comments (6)
Not sure I follow.
We're talking about Django admin? You can add any extra attributes to the widget via model definition so no "custom code" is required.
@Coalpaw please elaborate.
from pyuploadcare.
@dmitry-mukhin You can't really do it via a model field definition (unless you know something I don't). Attributes can only be added via the widget, which I agree can be done by overriding the widget in the admin and adding the required attribs, or by tacking on the attrib to the widget during the admin init which is also a common method. However, you are already adding a custom kwarg to the ImageField (manual_crop) which automagically adds the "data-crop" attrib to the underlying custom widget. Presumably this is due to the validation of the crop string, otherwise why not leave this up to the user to implement as a widget override as well?
from pyuploadcare.
I was referring to this:
https://github.com/uploadcare/pyuploadcare/blob/master/docs/django-widget.rst#advanced-widget-options
class CandidateForm(forms.Form):
photo = ImageField(widget=FileWidget(attrs={
'data-cdn-base': 'https://cdn.super-candidates.com',
'data-image-shrink': '1024x1024',
}))
from pyuploadcare.
I see. That would normally be how I would do it. I guess it is a little confusing as to why there would be the "manual_crop" kwarg on the field to set a widget attrib but other uploadcare-specific attributes can't be set that way and you have to fall back to manually specifying the widget and its configuration.
from pyuploadcare.
Widget options are numerous and are being added much faster than this Django integration lib can be updated.
Also, Django lib isn't strictly connected to a particular version of the widget so some things we might add here could be absent in an older version of the widget one can choose to use for some reason.
That's why we've tried to add "native" support for some of the most used settings and give a way to set anything else that can be added in the future via widget's settings.
Let me know if you're happy and I can close the issue.
from pyuploadcare.
Sounds good, closing the issue.
from pyuploadcare.
Related Issues (20)
- File Uploader (beta) HOT 4
- Badges in readme should link to appropriate pages, not images) HOT 6
- Fix functional tests that rely on network and expect some files in the project
- save_URL_duplicates and check_URL_duplicates are not supported
- Bump httpx version HOT 1
- Fix broken test coverage check
- multipage conversion (save_in_group param in documentJobSubmitParameters) HOT 1
- Update webhooks API (event types and versioning) HOT 3
- Add AWS Rekognition Moderation
- Deprecate PUT /group/{uuid}/storage/ HOT 9
- Add Secure Uploads functionality to Django Admin
- Implement generating URL tokens for signed URLs HOT 1
- Allow to pass a UUID + params when generating signed URL (ACL) HOT 1
- Update and refactor /transformations/image.py HOT 11
- Update pydandic version to use the last 2.x
- Update signed URLs implementation to work with ~ and , HOT 2
- Drop Python 3.6 support
- Consider caching the httpx SSL context HOT 1
- The usage of the deprecated pydantic.utils.deep_update
- Document "check duplicates" "save duplicates"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyuploadcare.