1- [ ![ Django-CC] ( https://img.shields.io/badge/Django-CC-ee66dd.svg )] ( https://github.com/codingjoe/django-cc )
21[ ![ version] ( https://img.shields.io/pypi/v/django-stdimage.svg )] ( https://pypi.python.org/pypi/django-stdimage/ )
32[ ![ ci] ( https://api.travis-ci.org/codingjoe/django-stdimage.svg?branch=master )] ( https://travis-ci.org/codingjoe/django-stdimage )
43[ ![ codecov] ( https://codecov.io/gh/codingjoe/django-stdimage/branch/master/graph/badge.svg )] ( https://codecov.io/gh/codingjoe/django-stdimage )
5- [ ![ code-health] ( https://landscape.io/github/codingjoe/django-stdimage/master/landscape.svg?style=flat )] ( https://landscape.io/github/codingjoe/django-stdimage/master )
64[ ![ MIT License] ( https://img.shields.io/badge/license-MIT-blue.svg )] ( LICENSE )
75
86# Django Standardized Image Field
@@ -22,7 +20,11 @@ Django Field that implement the following features:
2220
2321Simply install the latest stable package using the command
2422
25- ` pip install django-stdimage `
23+ ``` bash
24+ pip install django-stdimage
25+ # or
26+ pipenv install django-stdimage
27+ ```
2628
2729and add ` 'stdimage' ` to ` INSTALLED_APP ` s in your settings.py, that's it!
2830
@@ -38,6 +40,7 @@ Variations are specified within a dictionary. The key will be the attribute refe
3840A variation can be defined both as a tuple or a dictionary.
3941
4042Example:
43+
4144``` python
4245from django.db import models
4346from stdimage.models import StdImageField
@@ -70,6 +73,7 @@ class MyModel(models.Model):
7073 For using generated variations in templates use ` myimagefield.variation_name ` .
7174
7275Example:
76+
7377``` html
7478<a href =" {{ object.myimage.url }}" ><img alt =" " src =" {{ object.myimage.thumbnail.url }}" /></a >
7579```
@@ -86,7 +90,8 @@ The `StdImageField` doesn't implement any size validation. Validation can be spe
8690and using a set of validators shipped with this package.
8791Validators can be used for both Forms and Models.
8892
89- Example
93+ Example
94+
9095``` python
9196from django.db import models
9297from stdimage.validators import MinSizeValidator, MaxSizeValidator
@@ -123,7 +128,6 @@ pre_save.connect(pre_save_delete_callback, sender=models.MyModel)
123128
124129** Warning:** You should not use the signal callbacks in production. They may result in data loss.
125130
126-
127131### Async image processing
128132Tools like celery allow to execute time-consuming tasks outside of the request. If you don't want
129133to wait for your variations to be rendered in request, StdImage provides your the option to pass a
@@ -133,11 +137,7 @@ This example is based on celery.
133137
134138` tasks.py ` :
135139``` python
136- try :
137- from django.apps import apps
138- get_model = apps.get_model
139- except ImportError :
140- from django.apps import apps
140+ from django.apps import apps
141141
142142from celery import shared_task
143143
@@ -157,7 +157,7 @@ def process_photo_image(file_name, variations, storage):
157157from django.db import models
158158from stdimage.models import StdImageField
159159
160- from tasks import process_photo_image
160+ from . tasks import process_photo_image
161161
162162def image_processor (file_name , variations , storage ):
163163 process_photo_image.delay(file_name, variations, storage)
@@ -191,7 +191,3 @@ and therefore the huge memory footprint from previous versions.
191191
192192** Note:** PyPy seems to have some problems regarding multiprocessing,
193193for that matter all multiprocessing is disabled in PyPy.
194-
195- ## [ Contributing] ( CONTRIBUTING.md )
196-
197- ## [ License] ( LICENSE )
0 commit comments