Permalink
Browse files

Remove incorrect import

  • Loading branch information...
1 parent 4082186 commit 3644e9a753f7a1368a0a1cb6ef38526f5a50758e Zenobius Jiricek committed Feb 17, 2012
@@ -3,8 +3,8 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
-
from cms.menu_bases import CMSAttachMenu
+
from menus.base import (
Menu,
Modifier,
@@ -16,18 +16,20 @@
cut_after,
flatten,
)
+from .forms import MenuPluginSettingsForm
-from models import (
+from .models import (
ApplicationSettings,
MenuPluginSettings,
- TEMPLATE_PATH,
)
+
class MenuPlugin(CMSPluginBase):
model = MenuPluginSettings
name = _("Embedded Menu")
render_template = "cmsplugin_embeddedmenu/base.html"
admin_preview = False
+ form = MenuPluginSettingsForm
def render(self, context, instance, placeholder):
@@ -0,0 +1,23 @@
+from django.forms import ModelForm
+from django.utils.safestring import SafeString
+
+from .models import (
+ MenuPluginSettings,
+)
+
+
+class EmbedPagesAdminForm(ModelForm):
+
+ class Meta:
+ model = MenuPluginSettings
+
+ def __init__(self, *args, **kwargs):
+ super(EmbedPagesAdminForm, self).__init__(*args, **kwargs)
+ choices = [self.fields['root'].choices.__iter__().next()]
+ for page in self.fields['root'].queryset:
+ choices.append(
+ (page.id,
+ SafeString(''.join([u"   "*page.level,
+ page.__unicode__()]))))
+
+ self.fields['root'].choices = choices
@@ -138,4 +138,5 @@ def walkdir(self, path=None):
for item in dirs :
output += self.walkdir(os.path.join(root, item))
+
return output
@@ -8,6 +8,7 @@
DynamicTemplateChoices,
)
+
class ApplicationSettings(AppConf):
TEMPLATE_PATH = os.path.join("cmsplugin_embeddedmenu", "layouts")
CONTAINER_TEMPLATE_PATH = os.path.join(TEMPLATE_PATH, "containers")

0 comments on commit 3644e9a

Please sign in to comment.