forked from WnP/djangocms_bootstrap_carousel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cms_plugins.py
32 lines (28 loc) · 857 Bytes
/
cms_plugins.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
import time
import models
class MediaViewerPlugIn(CMSPluginBase):
model = models.MediaViewer
name = 'Media Viewer'
render_template = 'media_viewer.html'
# raw_id_fields = ('medias',)
filter_horizontal = ('medias',)
fieldsets = (
(None, {
'fields': ('title', 'slide_type', 'medias'),
}),
('More', {
'classes': ('collapse',),
'fields': ('width', 'height'),
}),
)
def render(self, context, instance, placeholder):
context.update({
'instance': instance,
'time': '-'.join([
str(instance.id),
repr(time.time()).replace('.', '_')]),
})
return context
plugin_pool.register_plugin(MediaViewerPlugIn)