mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-05-25 12:43:44 +00:00
Tell people to import fields from the models module
This commit is contained in:
parent
667e265c94
commit
af7c12cb68
5 changed files with 8 additions and 8 deletions
|
|
@ -34,7 +34,7 @@ Much like ``django.db.models.ImageField``, Specs are defined as properties
|
||||||
of a model class::
|
of a model class::
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from imagekit.models.fields import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
|
|
||||||
class Photo(models.Model):
|
class Photo(models.Model):
|
||||||
original_image = models.ImageField(upload_to='photos')
|
original_image = models.ImageField(upload_to='photos')
|
||||||
|
|
@ -49,7 +49,7 @@ an ImageFile-like object (just like with a normal
|
||||||
photo.original_image.url # > '/media/photos/birthday.tiff'
|
photo.original_image.url # > '/media/photos/birthday.tiff'
|
||||||
photo.formatted_image.url # > '/media/cache/photos/birthday_formatted_image.jpeg'
|
photo.formatted_image.url # > '/media/cache/photos/birthday_formatted_image.jpeg'
|
||||||
|
|
||||||
Check out ``imagekit.models.fields.ImageSpecField`` for more information.
|
Check out ``imagekit.models.ImageSpecField`` for more information.
|
||||||
|
|
||||||
|
|
||||||
Processors
|
Processors
|
||||||
|
|
@ -60,7 +60,7 @@ something to it, and return the result. By providing a list of processors to
|
||||||
your spec, you can expose different versions of the original image::
|
your spec, you can expose different versions of the original image::
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from imagekit.models.fields import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFill, Adjust
|
from imagekit.processors import ResizeToFill, Adjust
|
||||||
|
|
||||||
class Photo(models.Model):
|
class Photo(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ API Reference
|
||||||
:mod:`models` Module
|
:mod:`models` Module
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
.. automodule:: imagekit.models.fields
|
.. automodule:: imagekit.models
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@ import warnings
|
||||||
class ImageSpec(ImageSpecField):
|
class ImageSpec(ImageSpecField):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
warnings.warn('ImageSpec has been moved to'
|
warnings.warn('ImageSpec has been moved to'
|
||||||
' imagekit.models.fields.ImageSpecField. Please use that'
|
' imagekit.models.ImageSpecField. Please use that instead.',
|
||||||
' instead.', DeprecationWarning)
|
DeprecationWarning)
|
||||||
super(ImageSpec, self).__init__(*args, **kwargs)
|
super(ImageSpec, self).__init__(*args, **kwargs)
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ class ProcessedImageField(models.ImageField):
|
||||||
The ProcessedImageField constructor accepts all of the arguments that
|
The ProcessedImageField constructor accepts all of the arguments that
|
||||||
the :class:`django.db.models.ImageField` constructor accepts, as well
|
the :class:`django.db.models.ImageField` constructor accepts, as well
|
||||||
as the ``processors``, ``format``, and ``options`` arguments of
|
as the ``processors``, ``format``, and ``options`` arguments of
|
||||||
:class:`imagekit.models.fields.ImageSpecField`.
|
:class:`imagekit.models.ImageSpecField`.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if 'quality' in kwargs:
|
if 'quality' in kwargs:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from imagekit.models.fields import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import Adjust
|
from imagekit.processors import Adjust
|
||||||
from imagekit.processors import ResizeToFill
|
from imagekit.processors import ResizeToFill
|
||||||
from imagekit.processors import SmartCrop
|
from imagekit.processors import SmartCrop
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue