1. Guilherme Gondim
  2. django-galeria

Commits

Guilherme Gondim  committed 84dcf9f

Remove django-imagekit dependency

  • Participants
  • Parent commits 48498a5
  • Branches default

Comments (0)

Files changed (4)

File galeria/admin.py

View file
  • Ignore whitespace
 from django.template.response import TemplateResponse
 from django.utils.encoding import force_unicode
 from django.utils.translation import ugettext_lazy as _
-from imagekit.admin import AdminThumbnail
 from mptt.admin import MPTTModelAdmin
 
 from galeria.forms import AlbumForm, ZipUploadForm
 
 class PictureAdmin(admin.ModelAdmin):
     change_list_template = 'galeria/admin/change_list.html'
-    list_display = ('thumbnail', 'title', 'is_public', 'album', 'date_added')
+    list_display = ('title', 'is_public', 'album', 'date_added')
     list_display_links = ('title',)
     list_editable = ('album', 'is_public')
     list_filter = ('date_added', 'album', 'is_public')
     prepopulated_fields = {'slug': ('title',)}
     search_fields = ('title', 'slug', 'description')
 
-    thumbnail = AdminThumbnail(
-        image_field='thumbnail_image',
-        template='galeria/admin/thumbnail.html'
-    )
-    thumbnail.short_description = _('thumbnail')
-
     def get_urls(self):
         info = self.model._meta.app_label, self.model._meta.module_name
         default_patterns = super(PictureAdmin, self).get_urls()

File galeria/models.py

View file
  • Ignore whitespace
 from django.core.files.storage import default_storage
 from django.utils.translation import ugettext_lazy as _
 
-from imagekit.models import ImageSpec
-from imagekit.processors import Anchor, ResizeToFill, ResizeToFit, Transpose
 from mptt.fields import TreeForeignKey
 from mptt.managers import TreeManager
 from mptt.models import MPTTModel
 from galeria import EXIF
 
 
-DISPLAY_IMAGE_PROCESSORS = getattr(settings, 'GALERIA_DISPLAY_IMAGE_PROCESSORS', [
-    Transpose(Transpose.AUTO),
-    ResizeToFit(width=640, height=640)
-])
-THUMBNAIL_IMAGE_PROCESSORS = getattr(settings, 'GALERIA_THUMBNAIL_IMAGE_PROCESSORS', [
-    Transpose(Transpose.AUTO),
-    ResizeToFill(width=200, height=150, anchor=Anchor.CENTER)
-])
-COVER_IMAGE_PROCESSORS = getattr(settings, 'GALERIA_COVER_IMAGE_PROCESSORS', [
-    Transpose(Transpose.AUTO),
-    ResizeToFill(width=200, height=150, anchor=Anchor.CENTER)
-])
-
 ORDER_CHOICES = (
     ('-date_added', _('Descending by addition date')),
     ('date_added',  _('Ascending by addition date')),
     date_modified = models.DateTimeField(_('date modified'), auto_now=True)
     date_taken = models.DateTimeField(_('date taken'), null=True, editable=False)
     original_image = models.ImageField(_('image'), upload_to=picture_imagefield_path)
-    display_image = ImageSpec(
-        DISPLAY_IMAGE_PROCESSORS,
-        image_field='original_image',
-        options={'quality': 90},
-    )
-    thumbnail_image = ImageSpec(
-        THUMBNAIL_IMAGE_PROCESSORS,
-        image_field='original_image',
-        format='JPEG',
-        options={'quality': 75},
-    )
-    cover_image = ImageSpec(
-        COVER_IMAGE_PROCESSORS,
-        image_field='original_image',
-        format='JPEG',
-        options={'quality': 75},
-    )
     description = models.TextField(_('description'), blank=True)
     is_public = models.BooleanField(
         _('is public'),

File galeria/templates/galeria/admin/thumbnail.html

  • Ignore whitespace
-{% if thumbnail %}
-<a href="{{ model.get_absolute_url|default:original_image.url }}">
-  <img src="{{ thumbnail.url }}" alt="{{ model.title }}" style="max-height: 42px;"/>
-</a>
-{% endif %}

File setup.py

View file
  • Ignore whitespace
         'Programming Language :: Python',
         'Topic :: Software Development :: Libraries :: Python Modules',
     ],
-    install_requires=['django-imagekit<3.0', 'django-mptt']
+    install_requires=['django-mptt']
 )