Skip to content

Instantly share code, notes, and snippets.

View ojii's full-sized avatar

Jonas Obrist ojii

View GitHub Profile
In [1]: from simplegallery import models as sg
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Users/stefanfoulis/Documents/Coding/Workspaces/Main/affichage/<ipython console> in <module>()
/Users/stefanfoulis/Documents/Coding/Workspaces/Main/django-simplegallery/simplegallery/models.py in <module>()
6 from cms.models import Page
7 from cms.models import CMSPlugin
----> 8 from cms.models.fields import PageField
--- toolbar.html 2010-04-13 20:24:13.000000000 +0200
+++ toolbar_fix.html 2010-04-13 20:24:34.000000000 +0200
@@ -901,7 +901,7 @@
{% if auth %}
{% if has_change_permission %}<li><a href="{% url admin:cms_page_change page.pk %}"><span class="cms_toolbar_icon_padeadmin">Icon</span>{% trans "Page Settings" %}</a></li>
<!--li><a href="#"><span class="cms_toolbar_icon_pageunpublish">Icon</span>Unpublish Page</a></li-->
- <li><a href="{% url pages-root %}{% url admin:cms_page_history page.pk %}"><span class="cms_toolbar_icon_history">{% trans "history" %}</span>{% trans "View History" %}</a></li>
+ <li><a href="{% url admin:cms_page_history page.pk %}"><span class="cms_toolbar_icon_history">{% trans "history" %}</span>{% trans "View History" %}</a></li>
{% endif %}
{% endif %}
diff --git a/cms/models/pluginmodel.py b/cms/models/pluginmodel.py
index 5f4317f..5f5d4b5 100644
--- a/cms/models/pluginmodel.py
+++ b/cms/models/pluginmodel.py
@@ -237,6 +237,14 @@ class CMSPlugin(MpttPublisher):
Handle copying of any relations attached to this plugin
"""
+ def has_change_permission(self, request):
+ if self.page:
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)
diff --git a/cms/tests/menu.py b/cms/tests/menu.py
index 3b7724b..76a5ee7 100644
--- a/cms/tests/menu.py
+++ b/cms/tests/menu.py
@@ -34,6 +34,11 @@ class MenusTestCase(CMSTestCase):
self.page3 = self.create_page(parent_page=self.page2, published=True, in_navigation=True)
self.page4 = self.create_page(parent_page=None, published=True, in_navigation=True)
self.page5 = self.create_page(parent_page=self.page4, published=True, in_navigation=True)
+ self.page6 = self.create_page(parent_page=None, published=True, in_navigation=False)
+ self.page7 = self.create_page(parent_page=self.page6, published=True, in_navigation=True)
class BaseView(object):
"""
A base class to create class based views.
It will automatically check allowed methods if a list of allowed methods are
given. It also automatically tries to route to 'handle_`method`' methods if
they're available. So if for example you define a 'handle_post' method and
the request method is 'POST', this one will be called instead of 'handle'.
"""
<html>
<head>
<script ... my global script></script>
{% renderblock myhead %}
other stuf
{% renderblock myhead2 %}
</head>
<body>
<div id="page">
{% addtoblock myhead %}
<html>
<head>
<script ... my global script></script>
{% render_pre_block myhead %}
other stuf
{% render_pre_block myhead2 %}
</head>
<body>
<div id="page">
{% addtoblock myhead %}
[buildout]
eggs-directory = /path/to/some/folder/
SELECT "django_site"."id",
"django_site"."domain",
"django_site"."name"
FROM "django_site"
WHERE "django_site"."id" = 1 ;
SELECT "cms_page"."id",
"cms_page"."publisher_is_draft",
"cms_page"."publisher_public_id",