Permalink
Browse files

Enhanced plugin and added GalleryImageExtension model

- Added display_type to GalleryPlugin model
- Added new setting GALLERY_DISPLAY_TYPE_CHOICES
- Added GalleryImageExtension model
- Added inline for image extensions to Filer's Image admin
  • Loading branch information...
mbrochh committed Sep 3, 2013
1 parent 3cca651 commit 8d8222d215450416c2afe0e814d64983ae4ec833
View
@@ -1,5 +1,9 @@
=== ongoing ===
+- Added display_type to GalleryPlugin model
+- Added new setting GALLERY_DISPLAY_TYPE_CHOICES
+- Added GalleryImageExtension model
+- Added inline for image extensions to Filer's Image admin
=== 0.5 ===
View
@@ -72,6 +72,23 @@ Default: 10
Amount of galleries to display in the list view.
+GALLERY_DISPLAY_TYPE_CHOICES
+++++++++++++++++++++++++++++
+
+Default::
+
+ (
+ ('default', _('Default')),
+ ('teaser', _('Teaser')),
+ )
+
+When you use the ``Filer Gallery`` plugin, you can select the gallery that
+should be rendered and a display type. This is useful if one and the same
+gallery should be rendrerd in different ways at different places on your
+site. The selected value will be added to the plugin template's context with
+the variable name ``{{ display_type }}``.
+
+
Contribute
----------
View
@@ -2,8 +2,9 @@
from django.contrib import admin
from cms.admin.placeholderadmin import PlaceholderAdmin
+from filer.admin.imageadmin import ImageAdmin
-from image_gallery.models import Gallery, GalleryCategory
+from . import models
class GalleryAdmin(PlaceholderAdmin):
@@ -17,5 +18,10 @@ class GalleryCategoryAdmin(admin.ModelAdmin):
list_display = ('name', 'slug')
-admin.site.register(GalleryCategory, GalleryCategoryAdmin)
-admin.site.register(Gallery, GalleryAdmin)
+class GalleryImageInline(admin.TabularInline):
+ model = models.GalleryImageExtension
+
+
+admin.site.register(models.GalleryCategory, GalleryCategoryAdmin)
+admin.site.register(models.Gallery, GalleryAdmin)
+ImageAdmin.inlines = ImageAdmin.inlines[:] + [GalleryImageInline]
@@ -1,4 +1,15 @@
"""Settings of the ``image_gallery``` application."""
from django.conf import settings
+from django.utils.translation import ugettext_lazy as _
+
+GALLERY_DISPLAY_TYPE_CHOICES_DEFAULT = (
+ ('default', _('Default')),
+ ('teaser', _('Teaser')),
+)
PAGINATION_AMOUNT = getattr(settings, 'GALLERY_PAGINATION_AMOUNT', 10)
+DISPLAY_TYPE_CHOICES = getattr(
+ settings,
+ 'GALLERY_DISPLAY_TYPE_CHOICES',
+ GALLERY_DISPLAY_TYPE_CHOICES_DEFAULT
+)
@@ -17,6 +17,7 @@ def render(self, context, instance, placeholder):
'gallery': instance.gallery,
'images': instance.gallery.get_folder_images(),
'placeholder': placeholder,
+ 'display_type': instance.display_type,
})
return context
@@ -0,0 +1,120 @@
+# flake8: noqa
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding field 'GalleryPlugin.display_type'
+ db.add_column('cmsplugin_galleryplugin', 'display_type',
+ self.gf('django.db.models.fields.CharField')(default='', max_length=256, blank=True),
+ keep_default=False)
+
+
+ def backwards(self, orm):
+ # Deleting field 'GalleryPlugin.display_type'
+ db.delete_column('cmsplugin_galleryplugin', 'display_type')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'cms.cmsplugin': {
+ 'Meta': {'object_name': 'CMSPlugin'},
+ 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 9, 3, 0, 0)'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
+ 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
+ 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
+ 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'cms.placeholder': {
+ 'Meta': {'object_name': 'Placeholder'},
+ 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'filer.folder': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('parent', 'name'),)", 'object_name': 'Folder'},
+ 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'modified_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'owner': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'filer_owned_folders'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['filer.Folder']"}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})
+ },
+ 'image_gallery.gallery': {
+ 'Meta': {'object_name': 'Gallery'},
+ 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['image_gallery.GalleryCategory']", 'null': 'True', 'blank': 'True'}),
+ 'date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
+ 'folder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['filer.Folder']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_published': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'location': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'image_gallery.gallerycategory': {
+ 'Meta': {'object_name': 'GalleryCategory'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '32'})
+ },
+ 'image_gallery.galleryplugin': {
+ 'Meta': {'object_name': 'GalleryPlugin', 'db_table': "'cmsplugin_galleryplugin'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'display_type': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
+ 'gallery': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['image_gallery.Gallery']"})
+ }
+ }
+
+ complete_apps = ['image_gallery']
Oops, something went wrong.

0 comments on commit 8d8222d

Please sign in to comment.