Skip to content

Instantly share code, notes, and snippets.

@ojii
Created May 17, 2010 11:30
Show Gist options
  • Save ojii/403667 to your computer and use it in GitHub Desktop.
Save ojii/403667 to your computer and use it in GitHub Desktop.
diff --git a/cms/admin/placeholderadmin.py b/cms/admin/placeholderadmin.py
index b589111..aa7d415 100644
--- a/cms/admin/placeholderadmin.py
+++ b/cms/admin/placeholderadmin.py
@@ -124,7 +124,7 @@ class PlaceholderAdmin(ModelAdmin):
raise Http404
parent = get_object_or_404(CMSPlugin, pk=parent_id)
plugin = CMSPlugin(language=language, plugin_type=plugin_type,
- position=position, parent=parent)
+ position=position, parent=parent, placeholder=parent.placeholder)
else:
placeholder = get_object_or_404(Placeholder, pk=placeholder_id)
plugin = CMSPlugin(language=language, plugin_type=plugin_type,
diff --git a/cms/forms/widgets.py b/cms/forms/widgets.py
index 736a342..af2e599 100644
--- a/cms/forms/widgets.py
+++ b/cms/forms/widgets.py
@@ -193,7 +193,7 @@ class PlaceholderPluginEditorWidget(PluginEditor):
ph = None
context = {'add':True}
if ph:
- plugin_list = ph.cmsplugin_set.all().order_by('position')
+ plugin_list = ph.cmsplugin_set.filter(parent=None).order_by('position')
plugin_list = self.filter_func(self.request, plugin_list)
language = get_language_from_request(self.request)
copy_languages = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment