Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Working release for cmsplugin-flickr-slideshow

  • Loading branch information...
commit 5f08ceed5782cadaa4d9b8a10f99b127fbcb594a 1 parent c0dbab9
@facconi facconi authored
View
6 .gitignore
@@ -25,3 +25,9 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
+
+#PyCharm
+.idea
+
+#Mac Os X
+.DS_Store
View
5 README.md
@@ -1,4 +1,7 @@
cmsplugin_flickr_slideshow
==========================
-Plugin for Django CMS that makes easy to embed Flickr slideshows.
+Plugin for Django CMS that makes easy to embed Flickr slideshows.
+
+The plugin is available on [Django Packages](http://www.djangopackages.com/packages/p/cmsplugin_flickr_plugins/).
+
View
13 __init__.py
@@ -0,0 +1,13 @@
+VERSION = (0,1,0,'final',1)
+__version__ = '.'.join(map(str, VERSION))
+
+def get_version():
+ version = '%s.%s' % (VERSION[0], VERSION[1])
+ if VERSION[2]:
+ version = '%s.%s' % (version, VERSION[2])
+ if VERSION[3:] == ('alpha', 0):
+ version = '%s pre-alpha' % version
+ else:
+ if VERSION[3] != 'final':
+ version = '%s %s %s' % (version, VERSION[3], VERSION[4])
+ return version
View
20 cms_plugins.py
@@ -0,0 +1,20 @@
+from cms.plugin_base import CMSPluginBase
+from cms.plugin_pool import plugin_pool
+
+from cmsplugin_flickr_slideshow.models import FlickrSlideshow as FlickrSlideshowModel
+
+from django.utils.translation import ugettext as _
+
+class FlickrSlideshowPlugin(CMSPluginBase):
+ model = FlickrSlideshowModel
+ name = _("Flickr Slideshow")
+ render_template = "cmsplugin_flickr_slideshow/embed.html"
+
+ def render(self, context, instance, placeholder):
+ context.update({
+ 'object': instance,
+ 'placeholder': placeholder
+ })
+ return context
+
+plugin_pool.register_plugin(FlickrSlideshowPlugin)
View
60 migrations/0001_initial.py
@@ -0,0 +1,60 @@
+# -*- 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 model 'FlickrSlideshow'
+ db.create_table('cmsplugin_flickrslideshow', (
+ ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
+ ('flikr_id', self.gf('django.db.models.fields.CharField')(max_length=60)),
+ ('flashvars', self.gf('django.db.models.fields.CharField')(max_length=1000)),
+ ('allowfullscreen', self.gf('django.db.models.fields.BooleanField')(default=True)),
+ ('width', self.gf('django.db.models.fields.IntegerField')(default=510)),
+ ('height', self.gf('django.db.models.fields.IntegerField')(default=300)),
+ ))
+ db.send_create_signal('cmsplugin_flickr_slideshow', ['FlickrSlideshow'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'FlickrSlideshow'
+ db.delete_table('cmsplugin_flickrslideshow')
+
+
+ models = {
+ 'cms.cmsplugin': {
+ 'Meta': {'object_name': 'CMSPlugin'},
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ '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'})
+ },
+ 'cmsplugin_flickr_slideshow.flickrslideshow': {
+ 'Meta': {'object_name': 'FlickrSlideshow', 'db_table': "'cmsplugin_flickrslideshow'", '_ormbases': ['cms.CMSPlugin']},
+ 'allowfullscreen': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'flashvars': ('django.db.models.fields.CharField', [], {'max_length': '1000'}),
+ 'flikr_id': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
+ 'height': ('django.db.models.fields.IntegerField', [], {'default': '300'}),
+ 'width': ('django.db.models.fields.IntegerField', [], {'default': '510'})
+ }
+ }
+
+ complete_apps = ['cmsplugin_flickr_slideshow']
View
0  migrations/__init__.py
No changes.
View
23 models.py
@@ -0,0 +1,23 @@
+from django.db import models
+from django.utils.translation import ugettext as _
+
+from cms.models import CMSPlugin
+
+from cmsplugin_flickr_slideshow import settings
+
+class FlickrSlideshow(CMSPlugin):
+ flikr_id = models.CharField(_('video id'), max_length=60)
+ flashvars = models.CharField(_('flashvars'), max_length=1000)
+
+ allowfullscreen = models.BooleanField(
+ _('allow full screen'),
+ default=settings.CMS_FLICKR_SLIDESHOW_DEFAULT_ALLOW_FULLSCREEN
+ )
+
+ width = models.IntegerField(_('width'),
+ default=settings.CMS_FLICKR_SLIDESHOW_DEFAULT_WIDTH)
+ height = models.IntegerField(_('height'),
+ default=settings.CMS_FLICKR_SLIDESHOW_DEFAULT_HEIGHT)
+
+ def __unicode__(self):
+ return u'%s' % (self.flikr_id,)
View
13 settings.py
@@ -0,0 +1,13 @@
+"""
+Convenience module for access of custom youtube application settings,
+which enforces default settings when the main settings module does not
+contain the appropriate settings.
+"""
+from django.conf import settings
+
+# Allow full screen
+CMS_FLICKR_SLIDESHOW_DEFAULT_ALLOW_FULLSCREEN = getattr(settings, 'CMS_FLICKR_SLIDESHOW_DEFAULT_ALLOW_FULLSCREEN', True)
+
+# Width & Height
+CMS_FLICKR_SLIDESHOW_DEFAULT_WIDTH = getattr(settings, 'CMS_FLICKR_SLIDESHOW_DEFAULT_WIDTH', 400)
+CMS_FLICKR_SLIDESHOW_DEFAULT_HEIGHT = getattr(settings, 'CMS_FLICKR_SLIDESHOW_DEFAULT_HEIGHT', 300)
View
14 templates/cmsplugin_flickr_slideshow/embed.html
@@ -0,0 +1,14 @@
+{% spaceless %}
+<div class='flickrslideshow' style='width: {{ object.width }}px; height: {{ object.height }}px;'>
+ <object width="{{ object.width }}" height="{{ object.height }}">
+ <param name="flashvars"
+ value="{{ object.flashvars }}"/>
+ <param name="movie" value="http://www.flickr.com/apps/slideshow/show.swf?v={{ object.flickr_id }}"/>
+ <param name="allowFullScreen" value="{{ object.allowfullscreen|yesno:"true,false" }}"/>
+ <embed width="{{ object.width }}" height="{{ object.height }}" type="application/x-shockwave-flash"
+ src="http://www.flickr.com/apps/slideshow/show.swf?v={{ object.flickr_id }}"
+ allowfullscreen="{{ object.allowfullscreen|yesno:"true,false" }}"
+ flashvars="{{ object.flashvars }}"></embed>
+ </object>
+</div>
+{% endspaceless %}
Please sign in to comment.
Something went wrong with that request. Please try again.