diff options
author | gnowgi <nagarjun@gnowledge.org> | 2012-03-15 16:19:20 +0530 |
---|---|---|
committer | gnowgi <nagarjun@gnowledge.org> | 2012-03-15 16:19:20 +0530 |
commit | 7a4f561e851fdc7246d804c3abb6748b8a4199a6 (patch) | |
tree | d2afc3463fd49625a9be482012f5c3bfcf7c42b9 /gstudio/plugins | |
download | gnowsys-7a4f561e851fdc7246d804c3abb6748b8a4199a6.tar.gz |
master trunk of gnowsys-studio
Diffstat (limited to 'gstudio/plugins')
-rw-r--r-- | gstudio/plugins/__init__.py | 1 | ||||
-rw-r--r-- | gstudio/plugins/admin.py | 106 | ||||
-rw-r--r-- | gstudio/plugins/cms_app.py | 16 | ||||
-rw-r--r-- | gstudio/plugins/cms_plugins.py | 201 | ||||
-rw-r--r-- | gstudio/plugins/menu.py | 198 | ||||
-rw-r--r-- | gstudio/plugins/migrations/0001_initial.py | 151 | ||||
-rw-r--r-- | gstudio/plugins/migrations/0002_auto__add_field_latestnodetypesplugin_template_to_render__add_field_sele.py | 132 | ||||
-rw-r--r-- | gstudio/plugins/migrations/0003_auto__del_field_latestnodetypesplugin_metatype__del_field_latestnodetypesp.py | 172 | ||||
-rw-r--r-- | gstudio/plugins/migrations/0004_auto__add_field_latestnodetypesplugin_submetatypes.py | 142 | ||||
-rw-r--r-- | gstudio/plugins/migrations/0005_auto__add_randomnodetypesplugin.py | 151 | ||||
-rw-r--r-- | gstudio/plugins/migrations/__init__.py | 1 | ||||
-rw-r--r-- | gstudio/plugins/models.py | 170 | ||||
-rw-r--r-- | gstudio/plugins/placeholder.py | 66 | ||||
-rw-r--r-- | gstudio/plugins/settings.py | 93 |
14 files changed, 1600 insertions, 0 deletions
diff --git a/gstudio/plugins/__init__.py b/gstudio/plugins/__init__.py new file mode 100644 index 0000000..fa1f3e5 --- /dev/null +++ b/gstudio/plugins/__init__.py @@ -0,0 +1 @@ +"""Plugins for Gstudio""" diff --git a/gstudio/plugins/admin.py b/gstudio/plugins/admin.py new file mode 100644 index 0000000..9749520 --- /dev/null +++ b/gstudio/plugins/admin.py @@ -0,0 +1,106 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# This project incorporates work covered by the following copyright and permission notice: + +# Copyright (c) 2009, Julien Fache +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: + +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. + +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +"""Admin of Gstudio CMS Plugins""" +from django.contrib import admin +from django.template import RequestContext +from django.utils.translation import ugettext_lazy as _ + +from cms.plugin_rendering import render_placeholder +from cms.admin.placeholderadmin import PlaceholderAdmin + +from gstudio.models import Nodetype +from gstudio.admin.nodetype import NodetypeAdmin +from gstudio.settings import NODETYPE_BASE_MODEL + + +class NodetypePlaceholderAdmin(PlaceholderAdmin, NodetypeAdmin): + """NodetypePlaceholder Admin""" + fieldsets = ((None, {'fields': ('title', 'image', 'status')}), + (_('Content'), {'fields': ('content_placeholder',), + 'classes': ('plugin-holder', + 'plugin-holder-nopage')}), + (_('Options'), {'fields': ('featured', 'excerpt', 'template', + 'related', 'authors', + 'creation_date', + 'start_publication', + 'end_publication'), + 'classes': ('collapse', 'collapse-closed')}), + (_('Privacy'), {'fields': ('password', 'login_required',), + 'classes': ('collapse', 'collapse-closed')}), + (_('Discussion'), {'fields': ('comment_enabled', + 'pingback_enabled')}), + (_('Publication'), {'fields': ('sites', 'metatypes', + 'tags', 'slug')})) + + def save_model(self, request, nodetype, form, change): + """Fill the content field with the interpretation + of the placeholder""" + context = RequestContext(request) + nodetype.content = render_placeholder(nodetype.content_placeholder, context) + super(NodetypePlaceholderAdmin, self).save_model( + request, nodetype, form, change) + + +if NODETYPE_BASE_MODEL == 'gstudio.plugins.placeholder.NodetypePlaceholder': + admin.site.unregister(Nodetype) + admin.site.register(Nodetype, NodetypePlaceholderAdmin) diff --git a/gstudio/plugins/cms_app.py b/gstudio/plugins/cms_app.py new file mode 100644 index 0000000..05c4008 --- /dev/null +++ b/gstudio/plugins/cms_app.py @@ -0,0 +1,16 @@ +"""Applications hooks for gstudio.plugins""" +from django.utils.translation import ugettext_lazy as _ + +from cms.app_base import CMSApp +from cms.apphook_pool import apphook_pool + +from gstudio.plugins.settings import APP_MENUS + + +class GstudioApphook(CMSApp): + """Gstudio's Apphook""" + name = _('Gstudio App Hook') + urls = ['gstudio.urls'] + menus = APP_MENUS + +apphook_pool.register(GstudioApphook) diff --git a/gstudio/plugins/cms_plugins.py b/gstudio/plugins/cms_plugins.py new file mode 100644 index 0000000..6661e21 --- /dev/null +++ b/gstudio/plugins/cms_plugins.py @@ -0,0 +1,201 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# This project incorporates work covered by the following copyright and permission notice: + +# Copyright (c) 2009, Julien Fache +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: + +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +"""Plugins for CMS""" +import itertools + +from django.conf import settings +from django.utils.translation import ugettext as _ + +from tagging.models import TaggedItem +from cms.plugin_base import CMSPluginBase +from cms.plugin_pool import plugin_pool + +from gstudio.models import Nodetype +from gstudio.models import Author +from gstudio.managers import tags_published +from gstudio.plugins.models import RandomNodetypesPlugin +from gstudio.plugins.models import LatestNodetypesPlugin +from gstudio.plugins.models import SelectedNodetypesPlugin + + +class CMSLatestNodetypesPlugin(CMSPluginBase): + """Django-cms plugin for the latest nodetypes filtered""" + module = _('nodetypes') + model = LatestNodetypesPlugin + name = _('Latest nodetypes') + render_template = 'gstudio/cms/nodetype_list.html' + filter_horizontal = ['metatypes', 'authors', 'tags'] + fieldsets = ( + (None, { + 'fields': ( + 'number_of_nodetypes', + 'template_to_render' + ) + }), + (_('Sorting'), { + 'fields': ( + 'metatypes', + 'authors', + 'tags' + ), + 'classes': ( + 'collapse', + ) + }), + (_('Advanced'), { + 'fields': ( + 'submetatypes', + ), + }), + ) + + text_enabled = True + + def formfield_for_manytomany(self, db_field, request, **kwargs): + """Filtering manytomany field""" + if db_field.name == 'authors': + kwargs['queryset'] = Author.published.all() + if db_field.name == 'tags': + kwargs['queryset'] = tags_published() + return super(CMSLatestNodetypesPlugin, self).formfield_for_manytomany( + db_field, request, **kwargs) + + def render(self, context, instance, placeholder): + """Update the context with plugin's data""" + nodetypes = Nodetype.published.all() + + if instance.metatypes.count(): + cats = instance.metatypes.all() + + if instance.submetatypes: + cats = itertools.chain(cats, *[c.get_descendants() + for c in cats]) + + nodetypes = nodetypes.filter(metatypes__in=cats) + if instance.authors.count(): + nodetypes = nodetypes.filter(authors__in=instance.authors.all()) + if instance.tags.count(): + nodetypes = TaggedItem.objects.get_union_by_model( + nodetypes, instance.tags.all()) + + nodetypes = nodetypes.distinct()[:instance.number_of_nodetypes] + context.update({'nodetypes': nodetypes, + 'object': instance, + 'placeholder': placeholder}) + return context + + def icon_src(self, instance): + """Icon source of the plugin""" + return settings.STATIC_URL + u'gstudio/img/plugin.png' + + +class CMSSelectedNodetypesPlugin(CMSPluginBase): + """Django-cms plugin for a selection of nodetypes""" + module = _('nodetypes') + model = SelectedNodetypesPlugin + name = _('Selected nodetypes') + render_template = 'gstudio/cms/nodetype_list.html' + fields = ('nodetypes', 'template_to_render') + filter_horizontal = ['nodetypes'] + text_enabled = True + + def render(self, context, instance, placeholder): + """Update the context with plugin's data""" + context.update({'nodetypes': instance.nodetypes.all(), + 'object': instance, + 'placeholder': placeholder}) + return context + + def icon_src(self, instance): + """Icon source of the plugin""" + return settings.STATIC_URL + u'gstudio/img/plugin.png' + + +class CMSRandomNodetypesPlugin(CMSPluginBase): + """Django-cms plugin for random nodetypes""" + module = _('nodetypes') + model = RandomNodetypesPlugin + name = _('Random node types') + render_template = 'gstudio/cms/random_nodetypes.html' + fields = ('number_of_nodetypes', 'template_to_render') + text_enabled = True + + def render(self, context, instance, placeholder): + """Update the context with plugin's data""" + context.update( + {'number_of_nodetypes': instance.number_of_nodetypes, + 'template_to_render': str(instance.template_to_render) or + 'gstudio/tags/random_nodetypes.html'}) + return context + + def icon_src(self, instance): + """Icon source of the plugin""" + return settings.STATIC_URL + u'gstudio/img/plugin.png' + +plugin_pool.register_plugin(CMSLatestNodetypesPlugin) +plugin_pool.register_plugin(CMSSelectedNodetypesPlugin) +plugin_pool.register_plugin(CMSRandomNodetypesPlugin) diff --git a/gstudio/plugins/menu.py b/gstudio/plugins/menu.py new file mode 100644 index 0000000..d03b762 --- /dev/null +++ b/gstudio/plugins/menu.py @@ -0,0 +1,198 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# This project incorporates work covered by the following copyright and permission notice: + +# Copyright (c) 2009, Julien Fache +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: + +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. + +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +"""Menus for gstudio.plugins""" +from django.core.urlresolvers import reverse +from django.utils.translation import ugettext_lazy as _ + +from menus.base import Modifier +from menus.base import NavigationNode +from menus.menu_pool import menu_pool +from cms.menu_bases import CMSAttachMenu + +from gstudio.models import Nodetype +from gstudio.models import Author +from gstudio.models import Metatype +from gstudio.managers import tags_published +from gstudio.plugins.settings import HIDE_NODETYPE_MENU + + +class NodetypeMenu(CMSAttachMenu): + """Menu for the nodetypes organized by archives dates""" + name = _('Gstudio Nodetype Menu') + + def get_nodes(self, request): + """Return menu's node for nodetypes""" + nodes = [] + archives = [] + attributes = {'hidden': HIDE_NODETYPE_MENU} + for nodetype in Nodetype.published.all(): + year = nodetype.creation_date.strftime('%Y') + month = nodetype.creation_date.strftime('%m') + month_text = nodetype.creation_date.strftime('%b') + day = nodetype.creation_date.strftime('%d') + + key_archive_year = 'year-%s' % year + key_archive_month = 'month-%s-%s' % (year, month) + key_archive_day = 'day-%s-%s-%s' % (year, month, day) + + if not key_archive_year in archives: + nodes.append(NavigationNode( + year, reverse('gstudio_nodetype_archive_year', args=[year]), + key_archive_year, attr=attributes)) + archives.append(key_archive_year) + + if not key_archive_month in archives: + nodes.append(NavigationNode( + month_text, + reverse('gstudio_nodetype_archive_month', args=[year, month]), + key_archive_month, key_archive_year, + attr=attributes)) + archives.append(key_archive_month) + + if not key_archive_day in archives: + nodes.append(NavigationNode( + day, reverse('gstudio_nodetype_archive_day', + args=[year, month, day]), + key_archive_day, key_archive_month, + attr=attributes)) + archives.append(key_archive_day) + + nodes.append(NavigationNode(nodetype.title, nodetype.get_absolute_url(), + nodetype.pk, key_archive_day)) + return nodes + + +class MetatypeMenu(CMSAttachMenu): + """Menu for the metatypes""" + name = _('Gstudio Metatype Menu') + + def get_nodes(self, request): + """Return menu's node for metatypes""" + nodes = [] + nodes.append(NavigationNode(_('Metatypes'), + reverse('gstudio_metatype_list'), + 'metatypes')) + for metatype in Metatype.objects.all(): + nodes.append(NavigationNode(metatype.title, + metatype.get_absolute_url(), + metatype.pk, 'metatypes')) + return nodes + + +class AuthorMenu(CMSAttachMenu): + """Menu for the authors""" + name = _('Gstudio Author Menu') + + def get_nodes(self, request): + """Return menu's node for authors""" + nodes = [] + nodes.append(NavigationNode(_('Authors'), + reverse('gstudio_author_list'), + 'authors')) + for author in Author.published.all(): + nodes.append(NavigationNode(author.username, + reverse('gstudio_author_detail', + args=[author.username]), + author.pk, 'authors')) + return nodes + + +class TagMenu(CMSAttachMenu): + """Menu for the tags""" + name = _('Gstudio Tag Menu') + + def get_nodes(self, request): + """Return menu's node for tags""" + nodes = [] + nodes.append(NavigationNode(_('Tags'), reverse('gstudio_tag_list'), + 'tags')) + for tag in tags_published(): + nodes.append(NavigationNode(tag.name, + reverse('gstudio_tag_detail', + args=[tag.name]), + tag.pk, 'tags')) + return nodes + + +class NodetypeModifier(Modifier): + """Menu Modifier for nodetypes, + hide the MenuNodetype in navigation, not in breadcrumbs""" + + def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb): + """Modify nodes of a menu""" + if breadcrumb: + return nodes + for node in nodes: + if node.attr.get('hidden'): + nodes.remove(node) + return nodes + + +menu_pool.register_menu(NodetypeMenu) +menu_pool.register_menu(MetatypeMenu) +menu_pool.register_menu(AuthorMenu) +menu_pool.register_menu(TagMenu) +menu_pool.register_modifier(NodetypeModifier) diff --git a/gstudio/plugins/migrations/0001_initial.py b/gstudio/plugins/migrations/0001_initial.py new file mode 100644 index 0000000..3dc5163 --- /dev/null +++ b/gstudio/plugins/migrations/0001_initial.py @@ -0,0 +1,151 @@ +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding model 'LatestNodetypesPlugin' + db.create_table('cmsplugin_latestnodetypesplugin', ( + ('metatype', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['gstudio.Metatype'], null=True, blank=True)), + ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), + ('number_of_nodetypes', self.gf('django.db.models.fields.IntegerField')(default=5)), + ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), + )) + db.send_create_signal('plugins', ['LatestNodetypesPlugin']) + + # Adding model 'SelectedNodetypesPlugin' + db.create_table('cmsplugin_selectednodetypesplugin', ( + ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), + )) + db.send_create_signal('plugins', ['SelectedNodetypesPlugin']) + + # Adding M2M table for field nodetypes on 'SelectedNodetypesPlugin' + db.create_table('plugins_selectednodetypesplugin_nodetypes', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('selectednodetypesplugin', models.ForeignKey(orm['plugins.selectednodetypesplugin'], null=False)), + ('nodetype', models.ForeignKey(orm['gstudio.nodetype'], null=False)) + )) + db.create_unique('plugins_selectednodetypesplugin_nodetypes', ['selectednodetypesplugin_id', 'nodetype_id']) + + def backwards(self, orm): + + # Deleting model 'LatestNodetypesPlugin' + db.delete_table('cmsplugin_latestnodetypesplugin') + + # Deleting model 'SelectedNodetypesPlugin' + db.delete_table('cmsplugin_selectednodetypesplugin') + + # Removing M2M table for field nodetypes on 'SelectedNodetypesPlugin' + db.delete_table('plugins_selectednodetypesplugin_nodetypes') + + 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': {'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', 'blank': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + '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'}, + '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': '5', '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'}), + 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}), + 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.CMSPlugin']"}), + 'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': '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': {'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'}) + }, + 'plugins.latestnodetypesplugin': { + 'Meta': {'object_name': 'LatestNodetypesPlugin', 'db_table': "'cmsplugin_latestnodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'metatype': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gstudio.Metatype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_nodetypes': ('django.db.models.fields.IntegerField', [], {'default': '5'}) + }, + 'plugins.selectednodetypesplugin': { + 'Meta': {'object_name': 'SelectedNodetypesPlugin', 'db_table': "'cmsplugin_selectednodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'nodetypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Nodetype']", 'symmetrical': 'False'}) + }, + 'sites.site': { + 'Meta': {'object_name': 'Site', 'db_table': "'django_site'"}, + 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'gstudio.metatype': { + 'Meta': {'object_name': 'Metatype'}, + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'gstudio.nodetype': { + 'Meta': {'object_name': 'Nodetype'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Metatype']", 'symmetrical': 'False'}), + 'comment_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'end_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2042, 3, 15, 0, 0)'}), + 'excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}), + 'last_update': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'related': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'related_rel_+'", 'null': 'True', 'to': "orm['gstudio.Nodetype']"}), + 'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'start_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'tags': ('tagging.fields.TagField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + } + } + + complete_apps = ['plugins'] diff --git a/gstudio/plugins/migrations/0002_auto__add_field_latestnodetypesplugin_template_to_render__add_field_sele.py b/gstudio/plugins/migrations/0002_auto__add_field_latestnodetypesplugin_template_to_render__add_field_sele.py new file mode 100644 index 0000000..f70e114 --- /dev/null +++ b/gstudio/plugins/migrations/0002_auto__add_field_latestnodetypesplugin_template_to_render__add_field_sele.py @@ -0,0 +1,132 @@ +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding field 'LatestNodetypesPlugin.template_to_render' + db.add_column('cmsplugin_latestnodetypesplugin', 'template_to_render', self.gf('django.db.models.fields.CharField')(default='gstudio/cms/nodetype_list.html', max_length=250, blank=True), keep_default=False) + + # Adding field 'SelectedNodetypesPlugin.template_to_render' + db.add_column('cmsplugin_selectednodetypesplugin', 'template_to_render', self.gf('django.db.models.fields.CharField')(default='gstudio/cms/nodetype_list.html', max_length=250, blank=True), keep_default=False) + + def backwards(self, orm): + + # Deleting field 'LatestNodetypesPlugin.template_to_render' + db.delete_column('cmsplugin_latestnodetypesplugin', 'template_to_render') + + # Deleting field 'SelectedNodetypesPlugin.template_to_render' + db.delete_column('cmsplugin_selectednodetypesplugin', 'template_to_render') + + 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': {'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', 'blank': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + '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'}, + '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': '5', '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'}), + 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}), + 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.CMSPlugin']"}), + 'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': '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': {'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'}) + }, + 'plugins.latestnodetypesplugin': { + 'Meta': {'object_name': 'LatestNodetypesPlugin', 'db_table': "'cmsplugin_latestnodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'metatype': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['gstudio.Metatype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_nodetypes': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'plugins.selectednodetypesplugin': { + 'Meta': {'object_name': 'SelectedNodetypesPlugin', 'db_table': "'cmsplugin_selectednodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'nodetypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Nodetype']", 'symmetrical': 'False'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'sites.site': { + 'Meta': {'object_name': 'Site', 'db_table': "'django_site'"}, + 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'gstudio.metatype': { + 'Meta': {'object_name': 'Metatype'}, + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'gstudio.nodetype': { + 'Meta': {'object_name': 'Nodetype'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Metatype']", 'symmetrical': 'False'}), + 'comment_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'end_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2042, 3, 15, 0, 0)'}), + 'excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}), + 'last_update': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'related': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'related_rel_+'", 'null': 'True', 'to': "orm['gstudio.Nodetype']"}), + 'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'start_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'tags': ('tagging.fields.TagField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + } + } + + complete_apps = ['plugins'] diff --git a/gstudio/plugins/migrations/0003_auto__del_field_latestnodetypesplugin_metatype__del_field_latestnodetypesp.py b/gstudio/plugins/migrations/0003_auto__del_field_latestnodetypesplugin_metatype__del_field_latestnodetypesp.py new file mode 100644 index 0000000..271113e --- /dev/null +++ b/gstudio/plugins/migrations/0003_auto__del_field_latestnodetypesplugin_metatype__del_field_latestnodetypesp.py @@ -0,0 +1,172 @@ +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Deleting field 'LatestNodetypesPlugin.metatype' + db.delete_column('cmsplugin_latestnodetypesplugin', 'metatype_id') + + # Deleting field 'LatestNodetypesPlugin.author' + db.delete_column('cmsplugin_latestnodetypesplugin', 'author_id') + + # Adding M2M table for field tags on 'LatestNodetypesPlugin' + db.create_table('plugins_latestnodetypesplugin_tags', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('latestnodetypesplugin', models.ForeignKey(orm['plugins.latestnodetypesplugin'], null=False)), + ('tag', models.ForeignKey(orm['tagging.tag'], null=False)) + )) + db.create_unique('plugins_latestnodetypesplugin_tags', ['latestnodetypesplugin_id', 'tag_id']) + + # Adding M2M table for field metatypes on 'LatestNodetypesPlugin' + db.create_table('plugins_latestnodetypesplugin_metatypes', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('latestnodetypesplugin', models.ForeignKey(orm['plugins.latestnodetypesplugin'], null=False)), + ('metatype', models.ForeignKey(orm['gstudio.metatype'], null=False)) + )) + db.create_unique('plugins_latestnodetypesplugin_metatypes', ['latestnodetypesplugin_id', 'metatype_id']) + + # Adding M2M table for field authors on 'LatestNodetypesPlugin' + db.create_table('plugins_latestnodetypesplugin_authors', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('latestnodetypesplugin', models.ForeignKey(orm['plugins.latestnodetypesplugin'], null=False)), + ('user', models.ForeignKey(orm['auth.user'], null=False)) + )) + db.create_unique('plugins_latestnodetypesplugin_authors', ['latestnodetypesplugin_id', 'user_id']) + + def backwards(self, orm): + + # Adding field 'LatestNodetypesPlugin.metatype' + db.add_column('cmsplugin_latestnodetypesplugin', 'metatype', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['gstudio.Metatype'], null=True, blank=True), keep_default=False) + + # Adding field 'LatestNodetypesPlugin.author' + db.add_column('cmsplugin_latestnodetypesplugin', 'author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True), keep_default=False) + + # Removing M2M table for field tags on 'LatestNodetypesPlugin' + db.delete_table('plugins_latestnodetypesplugin_tags') + + # Removing M2M table for field metatypes on 'LatestNodetypesPlugin' + db.delete_table('plugins_latestnodetypesplugin_metatypes') + + # Removing M2M table for field authors on 'LatestNodetypesPlugin' + db.delete_table('plugins_latestnodetypesplugin_authors') + + 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': {'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', 'blank': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + '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'}, + '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': '5', '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'}), + 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'}), + 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.CMSPlugin']"}), + 'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': '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': {'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'}) + }, + 'plugins.latestnodetypesplugin': { + 'Meta': {'object_name': 'LatestNodetypesPlugin', 'db_table': "'cmsplugin_latestnodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['gstudio.Metatype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_nodetypes': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['tagging.Tag']", 'null': 'True', 'blank': 'True'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'plugins.selectednodetypesplugin': { + 'Meta': {'object_name': 'SelectedNodetypesPlugin', 'db_table': "'cmsplugin_selectednodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'nodetypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Nodetype']", 'symmetrical': 'False'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'sites.site': { + 'Meta': {'object_name': 'Site', 'db_table': "'django_site'"}, + 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'tagging.tag': { + 'Meta': {'object_name': 'Tag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}) + }, + 'gstudio.metatype': { + 'Meta': {'object_name': 'Metatype'}, + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'gstudio.nodetype': { + 'Meta': {'object_name': 'Nodetype'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Metatype']", 'symmetrical': 'False'}), + 'comment_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'end_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2042, 3, 15, 0, 0)'}), + 'excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}), + 'last_update': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'related': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'related_rel_+'", 'null': 'True', 'to': "orm['gstudio.Nodetype']"}), + 'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'start_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'tags': ('tagging.fields.TagField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + } + } + + complete_apps = ['plugins'] diff --git a/gstudio/plugins/migrations/0004_auto__add_field_latestnodetypesplugin_submetatypes.py b/gstudio/plugins/migrations/0004_auto__add_field_latestnodetypesplugin_submetatypes.py new file mode 100644 index 0000000..1d21430 --- /dev/null +++ b/gstudio/plugins/migrations/0004_auto__add_field_latestnodetypesplugin_submetatypes.py @@ -0,0 +1,142 @@ +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding field 'LatestNodetypesPlugin.submetatypes' + db.add_column('cmsplugin_latestnodetypesplugin', 'submetatypes', self.gf('django.db.models.fields.BooleanField')(default=True), keep_default=False) + + def backwards(self, orm): + + # Deleting field 'LatestNodetypesPlugin.submetatypes' + db.delete_column('cmsplugin_latestnodetypesplugin', 'submetatypes') + + 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'}, + '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'}), + 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), + 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.CMSPlugin']"}), + 'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': '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'}) + }, + 'plugins.latestnodetypesplugin': { + 'Meta': {'object_name': 'LatestNodetypesPlugin', 'db_table': "'cmsplugin_latestnodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['gstudio.Metatype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_nodetypes': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'submetatypes': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['tagging.Tag']", 'null': 'True', 'blank': 'True'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'plugins.selectednodetypesplugin': { + 'Meta': {'object_name': 'SelectedNodetypesPlugin', 'db_table': "'cmsplugin_selectednodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'nodetypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Nodetype']", 'symmetrical': 'False'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'sites.site': { + 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, + 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'tagging.tag': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Tag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}) + }, + 'gstudio.metatype': { + 'Meta': {'ordering': "['title']", 'object_name': 'Metatype'}, + 'description': ('django.db.models.fields.TextField', [], {'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'}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['gstudio.Metatype']"}), + 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) + }, + 'gstudio.nodetype': { + 'Meta': {'ordering': "['-creation_date']", 'object_name': 'Nodetype'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Metatype']", 'symmetrical': 'False'}), + 'comment_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'end_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2042, 3, 15, 0, 0)'}), + 'excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}), + 'last_update': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}), + 'pingback_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'related': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'related_rel_+'", 'null': 'True', 'to': "orm['gstudio.Nodetype']"}), + 'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}), + 'start_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'tags': ('tagging.fields.TagField', [], {}), + 'template': ('django.db.models.fields.CharField', [], {'max_length': '250'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + } + } + + complete_apps = ['plugins'] diff --git a/gstudio/plugins/migrations/0005_auto__add_randomnodetypesplugin.py b/gstudio/plugins/migrations/0005_auto__add_randomnodetypesplugin.py new file mode 100644 index 0000000..6c8bc5c --- /dev/null +++ b/gstudio/plugins/migrations/0005_auto__add_randomnodetypesplugin.py @@ -0,0 +1,151 @@ +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding model 'RandomNodetypesPlugin' + db.create_table('cmsplugin_randomnodetypesplugin', ( + ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), + ('number_of_nodetypes', self.gf('django.db.models.fields.IntegerField')(default=5)), + ('template_to_render', self.gf('django.db.models.fields.CharField')(max_length=250, blank=True)), + )) + db.send_create_signal('plugins', ['RandomNodetypesPlugin']) + + def backwards(self, orm): + + # Deleting model 'RandomNodetypesPlugin' + db.delete_table('cmsplugin_randomnodetypesplugin') + + 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'}, + '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'}) + }, + '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'}) + }, + 'plugins.latestnodetypesplugin': { + 'Meta': {'object_name': 'LatestNodetypesPlugin', 'db_table': "'cmsplugin_latestnodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['gstudio.Metatype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_nodetypes': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'submetatypes': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['tagging.Tag']", 'null': 'True', 'blank': 'True'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'plugins.randomnodetypesplugin': { + 'Meta': {'object_name': 'RandomNodetypesPlugin', 'db_table': "'cmsplugin_randomnodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_nodetypes': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'plugins.selectednodetypesplugin': { + 'Meta': {'object_name': 'SelectedNodetypesPlugin', 'db_table': "'cmsplugin_selectednodetypesplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'nodetypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['gstudio.Nodetype']", 'symmetrical': 'False'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'sites.site': { + 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, + 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'tagging.tag': { + 'Meta': {'ordering': "('name',)", 'object_name': 'Tag'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}) + }, + 'gstudio.metatype': { + 'Meta': {'ordering': "['title']", 'object_name': 'Metatype'}, + 'description': ('django.db.models.fields.TextField', [], {'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'}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['gstudio.Metatype']"}), + 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) + }, + 'gstudio.nodetype': { + 'Meta': {'ordering': "['-creation_date']", 'object_name': 'Nodetype'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'metatypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['gstudio.Metatype']", 'null': 'True', 'blank': 'True'}), + 'comment_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'content': ('django.db.models.fields.TextField', [], {}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'end_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2042, 3, 15, 0, 0)'}), + 'excerpt': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}), + 'last_update': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}), + 'pingback_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'related': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'related_rel_+'", 'null': 'True', 'to': "orm['gstudio.Nodetype']"}), + 'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}), + 'start_publication': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'tags': ('tagging.fields.TagField', [], {}), + 'template': ('django.db.models.fields.CharField', [], {'default': "'gstudio/nodetype_detail.html'", 'max_length': '250'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + } + } + + complete_apps = ['plugins'] diff --git a/gstudio/plugins/migrations/__init__.py b/gstudio/plugins/migrations/__init__.py new file mode 100644 index 0000000..d8c89e8 --- /dev/null +++ b/gstudio/plugins/migrations/__init__.py @@ -0,0 +1 @@ +"""Migrations for Gstudio Plugins""" diff --git a/gstudio/plugins/models.py b/gstudio/plugins/models.py new file mode 100644 index 0000000..a13bc8a --- /dev/null +++ b/gstudio/plugins/models.py @@ -0,0 +1,170 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# This project incorporates work covered by the following copyright and permission notice: + +# Copyright (c) 2009, Julien Fache +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: + +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. + +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +"""Models of Gstudio CMS Plugins""" +from django.db import models +from django.contrib.auth.models import User +from django.db.models.signals import post_save +from django.db.models.signals import post_delete +from django.utils.translation import ugettext_lazy as _ + +from tagging.models import Tag +from cms.models import CMSPlugin +from menus.menu_pool import menu_pool + +from gstudio.models import Nodetype +from gstudio.models import Metatype +from gstudio.plugins.settings import PLUGINS_TEMPLATES + +TEMPLATES = [('gstudio/cms/nodetype_list.html', _('Nodetype list (default)')), + ('gstudio/cms/nodetype_detail.html', _('Nodetype detailed'))] + \ + PLUGINS_TEMPLATES + + +class LatestNodetypesPlugin(CMSPlugin): + """CMS Plugin for displaying latest nodetypes""" + + metatypes = models.ManyToManyField( + Metatype, verbose_name=_('metatypes'), + blank=True, null=True) + submetatypes = models.BooleanField( + default=True, verbose_name=_('include submetatypes')) + authors = models.ManyToManyField( + User, verbose_name=_('authors'), blank=True, null=True) + tags = models.ManyToManyField( + Tag, verbose_name=_('tags'), blank=True, null=True) + + number_of_nodetypes = models.IntegerField( + _('number of nodetypes'), default=5) + template_to_render = models.CharField( + _('template'), blank=True, + max_length=250, choices=TEMPLATES, + help_text=_('Template used to display the plugin')) + + @property + def render_template(self): + """Override render_template to use + the template_to_render attribute""" + return self.template_to_render + + def copy_relations(self, old_instance): + """Duplicate ManyToMany relations on plugin copy""" + self.tags = old_instance.tags.all() + self.authors = old_instance.authors.all() + self.metatypes = old_instance.metatypes.all() + + def __unicode__(self): + return _('%s nodetypes') % self.number_of_nodetypes + + +class SelectedNodetypesPlugin(CMSPlugin): + """CMS Plugin for displaying custom nodetypes""" + + nodetypes = models.ManyToManyField( + Nodetype, verbose_name=_('nodetypes')) + template_to_render = models.CharField( + _('template'), blank=True, + max_length=250, choices=TEMPLATES, + help_text=_('Template used to display the plugin')) + + @property + def render_template(self): + """Override render_template to use + the template_to_render attribute""" + return self.template_to_render + + def copy_relations(self, old_instance): + """Duplicate ManyToMany relations on plugin copy""" + self.nodetypes = old_instance.nodetypes.all() + + def __unicode__(self): + return _('%s nodetypes') % self.nodetypes.count() + + +class RandomNodetypesPlugin(CMSPlugin): + """CMS Plugin for displaying random nodetypes""" + + number_of_nodetypes = models.IntegerField( + _('number of nodetypes'), default=5) + template_to_render = models.CharField( + _('template'), blank=True, + max_length=250, choices=TEMPLATES, + help_text=_('Template used to display the plugin')) + + def __unicode__(self): + return _('%s nodetypes') % self.number_of_nodetypes + + +def invalidate_menu_cache(sender, **kwargs): + """Signal receiver to invalidate the menu_pool + cache when a nodetype is posted""" + menu_pool.clear() + +post_save.connect( + invalidate_menu_cache, sender=Nodetype, + dispatch_uid='gstudio.nodetype.postsave.invalidate_menu_cache') +post_delete.connect( + invalidate_menu_cache, sender=Nodetype, + dispatch_uid='gstudio.nodetype.postdelete.invalidate_menu_cache') diff --git a/gstudio/plugins/placeholder.py b/gstudio/plugins/placeholder.py new file mode 100644 index 0000000..dc93640 --- /dev/null +++ b/gstudio/plugins/placeholder.py @@ -0,0 +1,66 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# This project incorporates work covered by the following copyright and permission notice: + +# Copyright (c) 2009, Julien Fache +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: + +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. + +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +"""Placeholder model for Gstudio""" +from cms.models.fields import PlaceholderField + +from gstudio.models import Nodetype + + +class NodetypePlaceholder(Nodetype): + """Nodetype with a Placeholder to edit content""" + + content_placeholder = PlaceholderField('content') + + class Meta: + """NodetypePlaceholder's Meta""" + abstract = True diff --git a/gstudio/plugins/settings.py b/gstudio/plugins/settings.py new file mode 100644 index 0000000..4202c5d --- /dev/null +++ b/gstudio/plugins/settings.py @@ -0,0 +1,93 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# This project incorporates work covered by the following copyright and permission notice: + +# Copyright (c) 2009, Julien Fache +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: + +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +"""Settings of Gstudio.plugins""" +import warnings + +from django.conf import settings +from django.utils.importlib import import_module + + +HIDE_NODETYPE_MENU = getattr(settings, 'GSTUDIO_HIDE_NODETYPE_MENU', True) + +PLUGINS_TEMPLATES = getattr(settings, 'GSTUDIO_PLUGINS_TEMPLATES', []) + + +APP_MENUS = [] +DEFAULT_APP_MENUS = ['gstudio.plugins.menu.NodetypeMenu', + 'gstudio.plugins.menu.MetatypeMenu', + 'gstudio.plugins.menu.TagMenu', + 'gstudio.plugins.menu.AuthorMenu'] + +for menu_string in getattr(settings, 'GSTUDIO_APP_MENUS', DEFAULT_APP_MENUS): + try: + dot = menu_string.rindex('.') + menu_module = menu_string[:dot] + menu_name = menu_string[dot + 1:] + APP_MENUS.append(getattr(import_module(menu_module), menu_name)) + except (ImportError, AttributeError): + warnings.warn('%s menu cannot be imported' % menu_string, + RuntimeWarning) |