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 /objectapp/plugins | |
download | gnowsys-7a4f561e851fdc7246d804c3abb6748b8a4199a6.tar.gz |
master trunk of gnowsys-studio
Diffstat (limited to 'objectapp/plugins')
-rw-r--r-- | objectapp/plugins/__init__.py | 1 | ||||
-rw-r--r-- | objectapp/plugins/admin.py | 78 | ||||
-rw-r--r-- | objectapp/plugins/cms_app.py | 63 | ||||
-rw-r--r-- | objectapp/plugins/cms_plugins.py | 182 | ||||
-rw-r--r-- | objectapp/plugins/menu.py | 180 | ||||
-rw-r--r-- | objectapp/plugins/migrations/0001_initial.py | 151 | ||||
-rw-r--r-- | objectapp/plugins/migrations/0002_auto__add_field_latestgbobjectsplugin_template_to_render__add_field_sele.py | 132 | ||||
-rw-r--r-- | objectapp/plugins/migrations/0003_auto__del_field_latestgbobjectsplugin_objecttype__del_field_latestgbobjectsp.py | 172 | ||||
-rw-r--r-- | objectapp/plugins/migrations/0004_auto__add_field_latestgbobjectsplugin_subobjecttypes.py | 142 | ||||
-rw-r--r-- | objectapp/plugins/migrations/0005_auto__add_randomgbobjectsplugin.py | 151 | ||||
-rw-r--r-- | objectapp/plugins/migrations/__init__.py | 1 | ||||
-rw-r--r-- | objectapp/plugins/models.py | 152 | ||||
-rw-r--r-- | objectapp/plugins/placeholder.py | 61 | ||||
-rw-r--r-- | objectapp/plugins/settings.py | 74 |
14 files changed, 1540 insertions, 0 deletions
diff --git a/objectapp/plugins/__init__.py b/objectapp/plugins/__init__.py new file mode 100644 index 00000000..499b6305 --- /dev/null +++ b/objectapp/plugins/__init__.py @@ -0,0 +1 @@ +"""Plugins for Objectapp""" diff --git a/objectapp/plugins/admin.py b/objectapp/plugins/admin.py new file mode 100644 index 00000000..677ea8be --- /dev/null +++ b/objectapp/plugins/admin.py @@ -0,0 +1,78 @@ + +# 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/>. + + + +# 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 Objectapp 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 objectapp.models import Gbobject +from objectapp.admin.gbobject import GbobjectAdmin +from objectapp.settings import GBOBJECT_BASE_MODEL + + +class GbobjectPlaceholderAdmin(PlaceholderAdmin, GbobjectAdmin): + """GbobjectPlaceholder 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', 'objecttypes', + 'tags', 'slug')})) + + def save_model(self, request, gbobject, form, change): + """Fill the content field with the interpretation + of the placeholder""" + context = RequestContext(request) + gbobject.content = render_placeholder(gbobject.content_placeholder, context) + super(GbobjectPlaceholderAdmin, self).save_model( + request, gbobject, form, change) + + +if GBOBJECT_BASE_MODEL == 'objectapp.plugins.placeholder.GbobjectPlaceholder': + admin.site.unregister(Gbobject) + admin.site.register(Gbobject, GbobjectPlaceholderAdmin) diff --git a/objectapp/plugins/cms_app.py b/objectapp/plugins/cms_app.py new file mode 100644 index 00000000..01b03136 --- /dev/null +++ b/objectapp/plugins/cms_app.py @@ -0,0 +1,63 @@ +# 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. +"""Applications hooks for objectapp.plugins""" +from django.utils.translation import ugettext_lazy as _ + +from cms.app_base import CMSApp +from cms.apphook_pool import apphook_pool + +from objectapp.plugins.settings import APP_MENUS + + +class ObjectappApphook(CMSApp): + """Objectapp's Apphook""" + name = _('Objectapp App Hook') + urls = ['objectapp.urls'] + menus = APP_MENUS + +apphook_pool.register(ObjectappApphook) diff --git a/objectapp/plugins/cms_plugins.py b/objectapp/plugins/cms_plugins.py new file mode 100644 index 00000000..e72496bd --- /dev/null +++ b/objectapp/plugins/cms_plugins.py @@ -0,0 +1,182 @@ +g# 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. +"""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 objectapp.models import Gbobject +from objectapp.models import Author +from objectapp.managers import tags_published +from objectapp.plugins.models import RandomGbobjectsPlugin +from objectapp.plugins.models import LatestGbobjectsPlugin +from objectapp.plugins.models import SelectedGbobjectsPlugin + + +class CMSLatestGbobjectsPlugin(CMSPluginBase): + """Django-cms plugin for the latest gbobjects filtered""" + module = _('gbobjects') + model = LatestGbobjectsPlugin + name = _('Latest gbobjects') + render_template = 'objectapp/cms/gbobject_list.html' + filter_horizontal = ['objecttypes', 'authors', 'tags'] + fieldsets = ( + (None, { + 'fields': ( + 'number_of_gbobjects', + 'template_to_render' + ) + }), + (_('Sorting'), { + 'fields': ( + 'objecttypes', + 'authors', + 'tags' + ), + 'classes': ( + 'collapse', + ) + }), + (_('Advanced'), { + 'fields': ( + 'subobjecttypes', + ), + }), + ) + + 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(CMSLatestGbobjectsPlugin, self).formfield_for_manytomany( + db_field, request, **kwargs) + + def render(self, context, instance, placeholder): + """Update the context with plugin's data""" + gbobjects = Gbobject.published.all() + + if instance.objecttypes.count(): + cats = instance.objecttypes.all() + + if instance.subobjecttypes: + cats = itertools.chain(cats, *[c.get_descendants() + for c in cats]) + + gbobjects = gbobjects.filter(objecttypes__in=cats) + if instance.authors.count(): + gbobjects = gbobjects.filter(authors__in=instance.authors.all()) + if instance.tags.count(): + gbobjects = TaggedItem.objects.get_union_by_model( + gbobjects, instance.tags.all()) + + gbobjects = gbobjects.distinct()[:instance.number_of_gbobjects] + context.update({'gbobjects': gbobjects, + 'object': instance, + 'placeholder': placeholder}) + return context + + def icon_src(self, instance): + """Icon source of the plugin""" + return settings.STATIC_URL + u'objectapp/img/plugin.png' + + +class CMSSelectedGbobjectsPlugin(CMSPluginBase): + """Django-cms plugin for a selection of gbobjects""" + module = _('gbobjects') + model = SelectedGbobjectsPlugin + name = _('Selected gbobjects') + render_template = 'objectapp/cms/gbobject_list.html' + fields = ('gbobjects', 'template_to_render') + filter_horizontal = ['gbobjects'] + text_enabled = True + + def render(self, context, instance, placeholder): + """Update the context with plugin's data""" + context.update({'gbobjects': instance.gbobjects.all(), + 'object': instance, + 'placeholder': placeholder}) + return context + + def icon_src(self, instance): + """Icon source of the plugin""" + return settings.STATIC_URL + u'objectapp/img/plugin.png' + + +class CMSRandomGbobjectsPlugin(CMSPluginBase): + """Django-cms plugin for random gbobjects""" + module = _('gbobjects') + model = RandomGbobjectsPlugin + name = _('Random gbobjects') + render_template = 'objectapp/cms/random_gbobjects.html' + fields = ('number_of_gbobjects', 'template_to_render') + text_enabled = True + + def render(self, context, instance, placeholder): + """Update the context with plugin's data""" + context.update( + {'number_of_gbobjects': instance.number_of_gbobjects, + 'template_to_render': str(instance.template_to_render) or + 'objectapp/tags/random_gbobjects.html'}) + return context + + def icon_src(self, instance): + """Icon source of the plugin""" + return settings.STATIC_URL + u'objectapp/img/plugin.png' + +plugin_pool.register_plugin(CMSLatestGbobjectsPlugin) +plugin_pool.register_plugin(CMSSelectedGbobjectsPlugin) +plugin_pool.register_plugin(CMSRandomGbobjectsPlugin) diff --git a/objectapp/plugins/menu.py b/objectapp/plugins/menu.py new file mode 100644 index 00000000..1f9871ec --- /dev/null +++ b/objectapp/plugins/menu.py @@ -0,0 +1,180 @@ +# 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. +"""Menus for objectapp.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 objectapp.models import Gbobject +from objectapp.models import Author +from objectapp.models import Objecttype +from objectapp.managers import tags_published +from objectapp.plugins.settings import HIDE_GBOBJECT_MENU + + +class GbobjectMenu(CMSAttachMenu): + """Menu for the gbobjects organized by archives dates""" + name = _('Objectapp Gbobject Menu') + + def get_nodes(self, request): + """Return menu's node for gbobjects""" + nodes = [] + archives = [] + attributes = {'hidden': HIDE_GBOBJECT_MENU} + for gbobject in Gbobject.published.all(): + year = gbobject.creation_date.strftime('%Y') + month = gbobject.creation_date.strftime('%m') + month_text = gbobject.creation_date.strftime('%b') + day = gbobject.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('objectapp_gbobject_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('objectapp_gbobject_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('objectapp_gbobject_archive_day', + args=[year, month, day]), + key_archive_day, key_archive_month, + attr=attributes)) + archives.append(key_archive_day) + + nodes.append(NavigationNode(gbobject.title, gbobject.get_absolute_url(), + gbobject.pk, key_archive_day)) + return nodes + + +class ObjecttypeMenu(CMSAttachMenu): + """Menu for the objecttypes""" + name = _('Objectapp Objecttype Menu') + + def get_nodes(self, request): + """Return menu's node for objecttypes""" + nodes = [] + nodes.append(NavigationNode(_('Objecttypes'), + reverse('objectapp_Objecttype_list'), + 'objecttypes')) + for Objecttype in Objecttype.objects.all(): + nodes.append(NavigationNode(Objecttype.title, + Objecttype.get_absolute_url(), + Objecttype.pk, 'objecttypes')) + return nodes + + +class AuthorMenu(CMSAttachMenu): + """Menu for the authors""" + name = _('Objectapp Author Menu') + + def get_nodes(self, request): + """Return menu's node for authors""" + nodes = [] + nodes.append(NavigationNode(_('Authors'), + reverse('objectapp_author_list'), + 'authors')) + for author in Author.published.all(): + nodes.append(NavigationNode(author.username, + reverse('objectapp_author_detail', + args=[author.username]), + author.pk, 'authors')) + return nodes + + +class TagMenu(CMSAttachMenu): + """Menu for the tags""" + name = _('Objectapp Tag Menu') + + def get_nodes(self, request): + """Return menu's node for tags""" + nodes = [] + nodes.append(NavigationNode(_('Tags'), reverse('objectapp_tag_list'), + 'tags')) + for tag in tags_published(): + nodes.append(NavigationNode(tag.name, + reverse('objectapp_tag_detail', + args=[tag.name]), + tag.pk, 'tags')) + return nodes + + +class GbobjectModifier(Modifier): + """Menu Modifier for gbobjects, + hide the MenuGbobject 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(GbobjectMenu) +menu_pool.register_menu(ObjecttypeMenu) +menu_pool.register_menu(AuthorMenu) +menu_pool.register_menu(TagMenu) +menu_pool.register_modifier(GbobjectModifier) diff --git a/objectapp/plugins/migrations/0001_initial.py b/objectapp/plugins/migrations/0001_initial.py new file mode 100644 index 00000000..893309e3 --- /dev/null +++ b/objectapp/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 'LatestGbobjectsPlugin' + db.create_table('cmsplugin_latestgbobjectsplugin', ( + ('Objecttype', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['objectapp.Objecttype'], 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_gbobjects', 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', ['LatestGbobjectsPlugin']) + + # Adding model 'SelectedGbobjectsPlugin' + db.create_table('cmsplugin_selectedgbobjectsplugin', ( + ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), + )) + db.send_create_signal('plugins', ['SelectedGbobjectsPlugin']) + + # Adding M2M table for field gbobjects on 'SelectedGbobjectsPlugin' + db.create_table('plugins_selectedgbobjectsplugin_gbobjects', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('selectedgbobjectsplugin', models.ForeignKey(orm['plugins.selectedgbobjectsplugin'], null=False)), + ('gbobject', models.ForeignKey(orm['objectapp.gbobject'], null=False)) + )) + db.create_unique('plugins_selectedgbobjectsplugin_gbobjects', ['selectedgbobjectsplugin_id', 'gbobject_id']) + + def backwards(self, orm): + + # Deleting model 'LatestGbobjectsPlugin' + db.delete_table('cmsplugin_latestgbobjectsplugin') + + # Deleting model 'SelectedGbobjectsPlugin' + db.delete_table('cmsplugin_selectedgbobjectsplugin') + + # Removing M2M table for field gbobjects on 'SelectedGbobjectsPlugin' + db.delete_table('plugins_selectedgbobjectsplugin_gbobjects') + + 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.latestgbobjectsplugin': { + 'Meta': {'object_name': 'LatestGbobjectsPlugin', 'db_table': "'cmsplugin_latestgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'Objecttype': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['objectapp.Objecttype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_gbobjects': ('django.db.models.fields.IntegerField', [], {'default': '5'}) + }, + 'plugins.selectedgbobjectsplugin': { + 'Meta': {'object_name': 'SelectedGbobjectsPlugin', 'db_table': "'cmsplugin_selectedgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'gbobjects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Gbobject']", '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'}) + }, + 'objectapp.Objecttype': { + 'Meta': {'object_name': 'Objecttype'}, + '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'}) + }, + 'objectapp.gbobject': { + 'Meta': {'object_name': 'Gbobject'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Objecttype']", '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['objectapp.Gbobject']"}), + '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/objectapp/plugins/migrations/0002_auto__add_field_latestgbobjectsplugin_template_to_render__add_field_sele.py b/objectapp/plugins/migrations/0002_auto__add_field_latestgbobjectsplugin_template_to_render__add_field_sele.py new file mode 100644 index 00000000..f1a52a2d --- /dev/null +++ b/objectapp/plugins/migrations/0002_auto__add_field_latestgbobjectsplugin_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 'LatestGbobjectsPlugin.template_to_render' + db.add_column('cmsplugin_latestgbobjectsplugin', 'template_to_render', self.gf('django.db.models.fields.CharField')(default='objectapp/cms/gbobject_list.html', max_length=250, blank=True), keep_default=False) + + # Adding field 'SelectedGbobjectsPlugin.template_to_render' + db.add_column('cmsplugin_selectedgbobjectsplugin', 'template_to_render', self.gf('django.db.models.fields.CharField')(default='objectapp/cms/gbobject_list.html', max_length=250, blank=True), keep_default=False) + + def backwards(self, orm): + + # Deleting field 'LatestGbobjectsPlugin.template_to_render' + db.delete_column('cmsplugin_latestgbobjectsplugin', 'template_to_render') + + # Deleting field 'SelectedGbobjectsPlugin.template_to_render' + db.delete_column('cmsplugin_selectedgbobjectsplugin', '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.latestgbobjectsplugin': { + 'Meta': {'object_name': 'LatestGbobjectsPlugin', 'db_table': "'cmsplugin_latestgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'Objecttype': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['objectapp.Objecttype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_gbobjects': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'plugins.selectedgbobjectsplugin': { + 'Meta': {'object_name': 'SelectedGbobjectsPlugin', 'db_table': "'cmsplugin_selectedgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'gbobjects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Gbobject']", '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'}) + }, + 'objectapp.Objecttype': { + 'Meta': {'object_name': 'Objecttype'}, + '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'}) + }, + 'objectapp.gbobject': { + 'Meta': {'object_name': 'Gbobject'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Objecttype']", '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['objectapp.Gbobject']"}), + '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/objectapp/plugins/migrations/0003_auto__del_field_latestgbobjectsplugin_objecttype__del_field_latestgbobjectsp.py b/objectapp/plugins/migrations/0003_auto__del_field_latestgbobjectsplugin_objecttype__del_field_latestgbobjectsp.py new file mode 100644 index 00000000..4aefa952 --- /dev/null +++ b/objectapp/plugins/migrations/0003_auto__del_field_latestgbobjectsplugin_objecttype__del_field_latestgbobjectsp.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 'LatestGbobjectsPlugin.Objecttype' + db.delete_column('cmsplugin_latestgbobjectsplugin', 'Objecttype_id') + + # Deleting field 'LatestGbobjectsPlugin.author' + db.delete_column('cmsplugin_latestgbobjectsplugin', 'author_id') + + # Adding M2M table for field tags on 'LatestGbobjectsPlugin' + db.create_table('plugins_latestgbobjectsplugin_tags', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('latestgbobjectsplugin', models.ForeignKey(orm['plugins.latestgbobjectsplugin'], null=False)), + ('tag', models.ForeignKey(orm['tagging.tag'], null=False)) + )) + db.create_unique('plugins_latestgbobjectsplugin_tags', ['latestgbobjectsplugin_id', 'tag_id']) + + # Adding M2M table for field objecttypes on 'LatestGbobjectsPlugin' + db.create_table('plugins_latestgbobjectsplugin_objecttypes', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('latestgbobjectsplugin', models.ForeignKey(orm['plugins.latestgbobjectsplugin'], null=False)), + ('Objecttype', models.ForeignKey(orm['objectapp.Objecttype'], null=False)) + )) + db.create_unique('plugins_latestgbobjectsplugin_objecttypes', ['latestgbobjectsplugin_id', 'Objecttype_id']) + + # Adding M2M table for field authors on 'LatestGbobjectsPlugin' + db.create_table('plugins_latestgbobjectsplugin_authors', ( + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), + ('latestgbobjectsplugin', models.ForeignKey(orm['plugins.latestgbobjectsplugin'], null=False)), + ('user', models.ForeignKey(orm['auth.user'], null=False)) + )) + db.create_unique('plugins_latestgbobjectsplugin_authors', ['latestgbobjectsplugin_id', 'user_id']) + + def backwards(self, orm): + + # Adding field 'LatestGbobjectsPlugin.Objecttype' + db.add_column('cmsplugin_latestgbobjectsplugin', 'Objecttype', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['objectapp.Objecttype'], null=True, blank=True), keep_default=False) + + # Adding field 'LatestGbobjectsPlugin.author' + db.add_column('cmsplugin_latestgbobjectsplugin', '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 'LatestGbobjectsPlugin' + db.delete_table('plugins_latestgbobjectsplugin_tags') + + # Removing M2M table for field objecttypes on 'LatestGbobjectsPlugin' + db.delete_table('plugins_latestgbobjectsplugin_objecttypes') + + # Removing M2M table for field authors on 'LatestGbobjectsPlugin' + db.delete_table('plugins_latestgbobjectsplugin_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.latestgbobjectsplugin': { + 'Meta': {'object_name': 'LatestGbobjectsPlugin', 'db_table': "'cmsplugin_latestgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['objectapp.Objecttype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_gbobjects': ('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.selectedgbobjectsplugin': { + 'Meta': {'object_name': 'SelectedGbobjectsPlugin', 'db_table': "'cmsplugin_selectedgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'gbobjects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Gbobject']", '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'}) + }, + 'objectapp.Objecttype': { + 'Meta': {'object_name': 'Objecttype'}, + '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'}) + }, + 'objectapp.gbobject': { + 'Meta': {'object_name': 'Gbobject'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Objecttype']", '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['objectapp.Gbobject']"}), + '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/objectapp/plugins/migrations/0004_auto__add_field_latestgbobjectsplugin_subobjecttypes.py b/objectapp/plugins/migrations/0004_auto__add_field_latestgbobjectsplugin_subobjecttypes.py new file mode 100644 index 00000000..448e480a --- /dev/null +++ b/objectapp/plugins/migrations/0004_auto__add_field_latestgbobjectsplugin_subobjecttypes.py @@ -0,0 +1,142 @@ +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding field 'LatestGbobjectsPlugin.subobjecttypes' + db.add_column('cmsplugin_latestgbobjectsplugin', 'subobjecttypes', self.gf('django.db.models.fields.BooleanField')(default=True), keep_default=False) + + def backwards(self, orm): + + # Deleting field 'LatestGbobjectsPlugin.subobjecttypes' + db.delete_column('cmsplugin_latestgbobjectsplugin', 'subobjecttypes') + + 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.latestgbobjectsplugin': { + 'Meta': {'object_name': 'LatestGbobjectsPlugin', 'db_table': "'cmsplugin_latestgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['objectapp.Objecttype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_gbobjects': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'subobjecttypes': ('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.selectedgbobjectsplugin': { + 'Meta': {'object_name': 'SelectedGbobjectsPlugin', 'db_table': "'cmsplugin_selectedgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'gbobjects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Gbobject']", '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'}) + }, + 'objectapp.Objecttype': { + 'Meta': {'ordering': "['title']", 'object_name': 'Objecttype'}, + '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['objectapp.Objecttype']"}), + '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'}) + }, + 'objectapp.gbobject': { + 'Meta': {'ordering': "['-creation_date']", 'object_name': 'Gbobject'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Objecttype']", '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['objectapp.Gbobject']"}), + '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/objectapp/plugins/migrations/0005_auto__add_randomgbobjectsplugin.py b/objectapp/plugins/migrations/0005_auto__add_randomgbobjectsplugin.py new file mode 100644 index 00000000..baa01a8a --- /dev/null +++ b/objectapp/plugins/migrations/0005_auto__add_randomgbobjectsplugin.py @@ -0,0 +1,151 @@ +from south.db import db +from south.v2 import SchemaMigration + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Adding model 'RandomGbobjectsPlugin' + db.create_table('cmsplugin_randomgbobjectsplugin', ( + ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), + ('number_of_gbobjects', 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', ['RandomGbobjectsPlugin']) + + def backwards(self, orm): + + # Deleting model 'RandomGbobjectsPlugin' + db.delete_table('cmsplugin_randomgbobjectsplugin') + + 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.latestgbobjectsplugin': { + 'Meta': {'object_name': 'LatestGbobjectsPlugin', 'db_table': "'cmsplugin_latestgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['objectapp.Objecttype']", 'null': 'True', 'blank': 'True'}), + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_gbobjects': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'subobjecttypes': ('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.randomgbobjectsplugin': { + 'Meta': {'object_name': 'RandomGbobjectsPlugin', 'db_table': "'cmsplugin_randomgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'number_of_gbobjects': ('django.db.models.fields.IntegerField', [], {'default': '5'}), + 'template_to_render': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}) + }, + 'plugins.selectedgbobjectsplugin': { + 'Meta': {'object_name': 'SelectedGbobjectsPlugin', 'db_table': "'cmsplugin_selectedgbobjectsplugin'", '_ormbases': ['cms.CMSPlugin']}, + 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'gbobjects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['objectapp.Gbobject']", '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'}) + }, + 'objectapp.Objecttype': { + 'Meta': {'ordering': "['title']", 'object_name': 'Objecttype'}, + '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['objectapp.Objecttype']"}), + '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'}) + }, + 'objectapp.gbobject': { + 'Meta': {'ordering': "['-creation_date']", 'object_name': 'Gbobject'}, + 'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), + 'objecttypes': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['objectapp.Objecttype']", '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['objectapp.Gbobject']"}), + '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': "'objectapp/gbobject_detail.html'", 'max_length': '250'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + } + } + + complete_apps = ['plugins'] diff --git a/objectapp/plugins/migrations/__init__.py b/objectapp/plugins/migrations/__init__.py new file mode 100644 index 00000000..66f67de9 --- /dev/null +++ b/objectapp/plugins/migrations/__init__.py @@ -0,0 +1 @@ +"""Migrations for Objectapp Plugins""" diff --git a/objectapp/plugins/models.py b/objectapp/plugins/models.py new file mode 100644 index 00000000..8e991a1f --- /dev/null +++ b/objectapp/plugins/models.py @@ -0,0 +1,152 @@ +# 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. +"""Models of Objectapp 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 objectapp.models import Gbobject +from objectapp.models import Objecttype +from objectapp.plugins.settings import PLUGINS_TEMPLATES + +TEMPLATES = [('objectapp/cms/gbobject_list.html', _('Gbobject list (default)')), + ('objectapp/cms/gbobject_detail.html', _('Gbobject detailed'))] + \ + PLUGINS_TEMPLATES + + +class LatestGbobjectsPlugin(CMSPlugin): + """CMS Plugin for displaying latest gbobjects""" + + objecttypes = models.ManyToManyField( + Objecttype, verbose_name=_('objecttypes'), + blank=True, null=True) + subobjecttypes = models.BooleanField( + default=True, verbose_name=_('include subobjecttypes')) + authors = models.ManyToManyField( + User, verbose_name=_('authors'), blank=True, null=True) + tags = models.ManyToManyField( + Tag, verbose_name=_('tags'), blank=True, null=True) + + number_of_gbobjects = models.IntegerField( + _('number of gbobjects'), 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.objecttypes = old_instance.objecttypes.all() + + def __unicode__(self): + return _('%s gbobjects') % self.number_of_gbobjects + + +class SelectedGbobjectsPlugin(CMSPlugin): + """CMS Plugin for displaying custom gbobjects""" + + gbobjects = models.ManyToManyField( + Gbobject, verbose_name=_('gbobjects')) + 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.gbobjects = old_instance.gbobjects.all() + + def __unicode__(self): + return _('%s gbobjects') % self.gbobjects.count() + + +class RandomGbobjectsPlugin(CMSPlugin): + """CMS Plugin for displaying random gbobjects""" + + number_of_gbobjects = models.IntegerField( + _('number of gbobjects'), 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 gbobjects') % self.number_of_gbobjects + + +def invalidate_menu_cache(sender, **kwargs): + """Signal receiver to invalidate the menu_pool + cache when an gbobject is posted""" + menu_pool.clear() + +post_save.connect( + invalidate_menu_cache, sender=Gbobject, + dispatch_uid='objectapp.gbobject.postsave.invalidate_menu_cache') +post_delete.connect( + invalidate_menu_cache, sender=Gbobject, + dispatch_uid='objectapp.gbobject.postdelete.invalidate_menu_cache') diff --git a/objectapp/plugins/placeholder.py b/objectapp/plugins/placeholder.py new file mode 100644 index 00000000..f2f89734 --- /dev/null +++ b/objectapp/plugins/placeholder.py @@ -0,0 +1,61 @@ +# 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. +"""Placeholder model for Objectapp""" +from cms.models.fields import PlaceholderField + +from objectapp.models import GbobjectAbstractClass + + +class GbobjectPlaceholder(GbobjectAbstractClass): + """Gbobject with a Placeholder to edit content""" + + content_placeholder = PlaceholderField('content') + + class Meta: + """GbobjectPlaceholder's Meta""" + abstract = True diff --git a/objectapp/plugins/settings.py b/objectapp/plugins/settings.py new file mode 100644 index 00000000..e679e3ea --- /dev/null +++ b/objectapp/plugins/settings.py @@ -0,0 +1,74 @@ +# 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. +"""Settings of Objectapp.plugins""" +import warnings + +from django.conf import settings +from django.utils.importlib import import_module + + +HIDE_GBOBJECT_MENU = getattr(settings, 'OBJECTAPP_HIDE_GBOBJECT_MENU', True) + +PLUGINS_TEMPLATES = getattr(settings, 'OBJECTAPP_PLUGINS_TEMPLATES', []) + + +APP_MENUS = [] +DEFAULT_APP_MENUS = ['objectapp.plugins.menu.GbobjectMenu', + 'objectapp.plugins.menu.ObjecttypeMenu', + 'objectapp.plugins.menu.TagMenu', + 'objectapp.plugins.menu.AuthorMenu'] + +for menu_string in getattr(settings, 'OBJECTAPP_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) |