Created
June 1, 2018 07:52
-
-
Save CITGuru/7b23863c6b4b97c9177219418442c4da to your computer and use it in GitHub Desktop.
This file contains 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
from django.forms import ModelForm | |
from .models import Bin | |
from cloudinary.forms import CloudinaryFileField, CloudinaryJsFileField | |
class ServerUploadBinForm(ModelForm): | |
class Meta: | |
model = Bin | |
# To add some options, tags, transformations to your cloudinary image upload | |
class ServerUploadBinFormWithOptions(ModelForm): | |
class Meta: | |
model = Bin | |
image = CloudinaryFileField( | |
attrs={'style': "margin-top: 30px"}, | |
options={ | |
'tags': "directly_uploaded", | |
'crop': 'limit', 'width': 1000, 'height': 1000, | |
'eager': [{'crop': 'fill', 'width': 150, 'height': 100}] | |
} | |
) | |
class DirectUploadBinForm(ModelForm): | |
class Meta: | |
model = Bin | |
image = CloudinaryJsFileField() | |
# To add some options, tags, transformations to your cloudinary image upload | |
class DirectUploadBinFormWithOptions(ModelForm): | |
class Meta: | |
model = Bin | |
image = CloudinaryJsFileField( | |
attrs={'style': "margin-top: 30px"}, | |
options={ | |
'tags': "directly_uploaded", | |
'crop': 'limit', 'width': 1000, 'height': 1000, | |
'eager' [{'crop': 'fill', 'width': 150, 'height': 100}] | |
} | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment