Browse files

included missing libs and initial migrations

  • Loading branch information...
1 parent 22b2524 commit 2eb5903965092a479f219aac3cff952f30e2fb09 Zenobius Jiricek committed Dec 30, 2011
View
4 cmsplugin_embeddedmenu/cms_plugins.py
@@ -18,12 +18,12 @@
)
from models import (
- Settings,
+ MenuPluginSettings,
TEMPLATE_PATH,
)
class MenuPlugin(CMSPluginBase):
- model = Settings
+ model = MenuPluginSettings
name = _("Embedded Menu")
render_template = "cmsplugin_menu/menu.html"
View
8 cmsplugin_embeddedmenu/lib/choices.py
@@ -8,19 +8,11 @@
from cms.models import Placeholder, Page
from .formatting import deslugify
-from ..urls import SYNCDB_FINISHED
class DynamicChoice(object):
"""
Trivial example of creating a dynamic choice
"""
- ready=False
-
- def __new__(self,*args, **kwargs):
- if SYNCDB_FINISHED:
- self.ready=True
- else:
- pass
def __iter__(self, *args, **kwargs):
for choice in self.generate():
View
15 cmsplugin_embeddedmenu/lib/formatting.py
@@ -0,0 +1,15 @@
+import re
+
+def deslugify(value):
+ """
+ Cleans up a slug by removing slug separator characters that occur at the
+ beginning or end of a slug.
+ """
+ reverse_map = {
+ "_" : " ",
+ "-" : " : ",
+ }
+
+ for _from, _to in reverse_map.iteritems():
+ value = re.sub(_from, _to, value)
+ return value
View
92 cmsplugin_embeddedmenu/migrations/0001_initial.py
@@ -0,0 +1,92 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding model 'MenuPluginSettings'
+ db.create_table('cmsplugin_menupluginsettings', (
+ ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
+ ('root', self.gf('django.db.models.fields.related.ForeignKey')(default=1, to=orm['cms.Page'])),
+ ('start_level', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ('depth', self.gf('django.db.models.fields.IntegerField')(default=0)),
+ ))
+ db.send_create_signal('cmsplugin_embeddedmenu', ['MenuPluginSettings'])
+
+
+ def backwards(self, orm):
+
+ # Deleting model 'MenuPluginSettings'
+ db.delete_table('cmsplugin_menupluginsettings')
+
+
+ models = {
+ 'cms.cmsplugin': {
+ 'Meta': {'object_name': 'CMSPlugin'},
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
+ 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
+ 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
+ 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'cms.page': {
+ 'Meta': {'ordering': "('site', 'tree_id', 'lft')", 'object_name': 'Page'},
+ 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+ 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+ 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
+ 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'limit_visibility_in_menu': ('django.db.models.fields.SmallIntegerField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
+ 'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'moderator_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '1', 'blank': 'True'}),
+ 'navigation_extenders': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['cms.Page']"}),
+ 'placeholders': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['cms.Placeholder']", 'symmetrical': 'False'}),
+ 'publication_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'publication_end_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+ 'published': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ '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.Page']"}),
+ 'publisher_state': ('django.db.models.fields.SmallIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'reverse_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '40', 'null': 'True', 'blank': 'True'}),
+ 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+ 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
+ 'soft_root': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
+ 'template': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'cms.placeholder': {
+ 'Meta': {'object_name': 'Placeholder'},
+ 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
+ },
+ 'cmsplugin_embeddedmenu.menupluginsettings': {
+ 'Meta': {'object_name': 'MenuPluginSettings', 'db_table': "'cmsplugin_menupluginsettings'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'depth': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'root': ('django.db.models.fields.related.ForeignKey', [], {'default': '1', 'to': "orm['cms.Page']"}),
+ 'start_level': ('django.db.models.fields.IntegerField', [], {'default': '0'})
+ },
+ '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'})
+ }
+ }
+
+ complete_apps = ['cmsplugin_embeddedmenu']
View
0 cmsplugin_embeddedmenu/migrations/__init__.py
No changes.
View
3 cmsplugin_embeddedmenu/models.py
@@ -5,13 +5,12 @@
from .lib.choices import (
DynamicTemplateChoices,
- PagesDynamicChoices,
PageAttributeDynamicChoices,
)
TEMPLATE_PATH = os.path.join("cmsplugin_menu", "layouts")
-class Settings(CMSPlugin):
+class MenuPluginSettings(CMSPlugin):
""" Stores options for cmsplugin that Embeds a menu
"""

0 comments on commit 2eb5903

Please sign in to comment.