S3 fields to upload images to s3 instead of file system
Project description
Django has ImageField and FileField which can be used for file and image operations. Django fields has problem that they store image and files on disk. They also don't delete older files when new files are uploaded. To solve this issue new field developed.
cf_s3field.S3ImageField
-----------------------
``s3ImageField`` is django model field which is replacement for django ``ImageField``.
```python
from cf_s3field.files import S3ImageField
class User(models.Model):
first_name = models.CharField(max_length=100)
profile_pic = S3ImageField(bucket='<your bucket>', key='profile_user_{first_name}')
user = User.objects.get(id=1)
user.first_name = "Hitul"
user.save()
```
In above example key ``first_name`` will be replaced by ``Hitul``. ImageField will also accept default django ImageField parameters. key is file name format. In s3 you will store multiple files. To seperate all images from each other key is introduced. Key values will be repalced by values specified in as extra attributes.
cf_s3field.S3FileField
-----------------------
``s3FileField`` is django model field which is replacement for django ``FileField``.
```python
from cf_s3field.files import S3ImageField
class User(models.Model):
first_name = models.CharField(max_length=100)
resume = S3FileField(bucket='<your bucket>', key='profile_user_{first_name}')
user = User.objects.get(id=1)
user.first_name = "Hitul"
user.save()
```
0.0.4 - Fri Oct 30
------------------
- Django 1.7 support
0.0.3 - Wed Oct 28
------------------
- No need to specifify migrate as argument
- Lazy connection implemented. When someone uploads at that time connection to boto will be created.
0.0.2 - Mon Oct 26
------------------
- README.md file changed to README.rst
- Debug statements removed
0.0.1 - Sat Oct 24
------------------
Initial release
cf_s3field.S3ImageField
-----------------------
``s3ImageField`` is django model field which is replacement for django ``ImageField``.
```python
from cf_s3field.files import S3ImageField
class User(models.Model):
first_name = models.CharField(max_length=100)
profile_pic = S3ImageField(bucket='<your bucket>', key='profile_user_{first_name}')
user = User.objects.get(id=1)
user.first_name = "Hitul"
user.save()
```
In above example key ``first_name`` will be replaced by ``Hitul``. ImageField will also accept default django ImageField parameters. key is file name format. In s3 you will store multiple files. To seperate all images from each other key is introduced. Key values will be repalced by values specified in as extra attributes.
cf_s3field.S3FileField
-----------------------
``s3FileField`` is django model field which is replacement for django ``FileField``.
```python
from cf_s3field.files import S3ImageField
class User(models.Model):
first_name = models.CharField(max_length=100)
resume = S3FileField(bucket='<your bucket>', key='profile_user_{first_name}')
user = User.objects.get(id=1)
user.first_name = "Hitul"
user.save()
```
0.0.4 - Fri Oct 30
------------------
- Django 1.7 support
0.0.3 - Wed Oct 28
------------------
- No need to specifify migrate as argument
- Lazy connection implemented. When someone uploads at that time connection to boto will be created.
0.0.2 - Mon Oct 26
------------------
- README.md file changed to README.rst
- Debug statements removed
0.0.1 - Sat Oct 24
------------------
Initial release
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
cf_s3field-0.0.4.zip
(12.6 kB
view details)
cf_s3field-0.0.4.tar.gz
(8.7 kB
view details)
File details
Details for the file cf_s3field-0.0.4.zip
.
File metadata
- Download URL: cf_s3field-0.0.4.zip
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2797dc8d4771021199cb48516c985d898b1441481abbddd209e39ea116e83a4 |
|
MD5 | f667c5994d1828d5842855ba66ac7307 |
|
BLAKE2b-256 | 2993ebc4ac2c6e4e077b829173eb43ebae040f7cf990ef4c23db5fac406ccf8f |
File details
Details for the file cf_s3field-0.0.4.tar.gz
.
File metadata
- Download URL: cf_s3field-0.0.4.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b5420f12d204cc2a47b09a37747fa37e9d067b50fa1f0797e80622387058bc9 |
|
MD5 | a34c0f4f6c40c951c65410880491b905 |
|
BLAKE2b-256 | b54475cf7be77875dd769e5d488c06e0047fff7c19d549247881699efad225dd |