mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-24 06:54:44 +00:00
Renamed IKModel to IMageModel
This commit is contained in:
parent
82ecb3baef
commit
75d39a88a1
4 changed files with 11 additions and 11 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from django.db.models.loading import cache
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from optparse import make_option
|
||||
from imagekit.models import IKModel
|
||||
from imagekit.models import ImageModel
|
||||
from imagekit.specs import ImageSpec
|
||||
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ def flush_cache(apps, options):
|
|||
|
||||
for app_label in apps:
|
||||
app = cache.get_app(app_label)
|
||||
models = [m for m in cache.get_models(app) if issubclass(m, IKModel)]
|
||||
models = [m for m in cache.get_models(app) if issubclass(m, ImageModel)]
|
||||
|
||||
for model in models:
|
||||
for obj in model.objects.all():
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ from imagekit.utils import img_to_fobj
|
|||
ImageFile.MAXBLOCK = getattr(settings, 'PIL_IMAGEFILE_MAXBLOCK', 256 * 2 ** 10)
|
||||
|
||||
|
||||
class IKModelBase(ModelBase):
|
||||
class ImageModelBase(ModelBase):
|
||||
def __init__(cls, name, bases, attrs):
|
||||
parents = [b for b in bases if isinstance(b, IKModelBase)]
|
||||
parents = [b for b in bases if isinstance(b, ImageModelBase)]
|
||||
if not parents:
|
||||
return
|
||||
user_opts = getattr(cls, 'IKOptions', None)
|
||||
|
|
@ -36,14 +36,14 @@ class IKModelBase(ModelBase):
|
|||
setattr(cls, '_ik', opts)
|
||||
|
||||
|
||||
class IKModel(models.Model):
|
||||
class ImageModel(models.Model):
|
||||
""" Abstract base class implementing all core ImageKit functionality
|
||||
|
||||
Subclasses of IKModel can override the inner IKOptions class to customize
|
||||
Subclasses of ImageModel can override the inner IKOptions class to customize
|
||||
storage locations and other options.
|
||||
|
||||
"""
|
||||
__metaclass__ = IKModelBase
|
||||
__metaclass__ = ImageModelBase
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
|
@ -83,7 +83,7 @@ class IKModel(models.Model):
|
|||
|
||||
def save(self, clear_cache=True, *args, **kwargs):
|
||||
is_new_object = self._get_pk_val is None
|
||||
super(IKModel, self).save(*args, **kwargs)
|
||||
super(ImageModel, self).save(*args, **kwargs)
|
||||
if is_new_object:
|
||||
clear_cache = False
|
||||
spec = self._ik.preprocessor_spec
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
""" ImageKit image specifications
|
||||
|
||||
All imagekit specifications must inherit from the ImageSpec class. Models
|
||||
inheriting from IKModel will be modified with a descriptor/accessor for each
|
||||
inheriting from ImageModel will be modified with a descriptor/accessor for each
|
||||
spec found.
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from django.db import models
|
|||
from django.test import TestCase
|
||||
|
||||
from imagekit import processors
|
||||
from imagekit.models import IKModel
|
||||
from imagekit.models import ImageModel
|
||||
from imagekit.specs import ImageSpec
|
||||
from imagekit.lib import Image
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class TestResizeCropped(ImageSpec):
|
|||
access_as = 'cropped'
|
||||
processors = [ResizeCropped]
|
||||
|
||||
class TestPhoto(IKModel):
|
||||
class TestPhoto(ImageModel):
|
||||
""" Minimal ImageModel class for testing """
|
||||
image = models.ImageField(upload_to='images')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue