django-cms / django-cms Goto Github PK
View Code? Open in Web Editor NEWThe easy-to-use and developer-friendly enterprise CMS powered by Django
Home Page: http://www.django-cms.org
License: BSD 3-Clause "New" or "Revised" License
The easy-to-use and developer-friendly enterprise CMS powered by Django
Home Page: http://www.django-cms.org
License: BSD 3-Clause "New" or "Revised" License
if you edit a page the first plugin should be already be open and ready for editing
so easy install is working
It would be nice if you could copy the plugins from other languages and if you could see in the page view which languages still need translations
META and KEYWORD fields in title
it would be nice if you could edit content in place directly on the site
A way to customized the menu based on if you are logged in or not.
Page preview doesn't work unless page is published. I get a 404 unless I publish the page I would think that a draft should be viewable.
It seems that multilingual thinks cmsplugin to be a translatable (by multilingual) model. It replaces the standard ModelAdmin with its own, and tests for multilingual compatibility followingly (in multilingual/utils.py):
def is_multilingual_model(model):
"""
Return True if `model` is a multilingual model.
"""
return hasattr(model._meta, 'translation_model')
Here is the full traceback I get in the plugins (all plugins) editing view:
Environment:
Request Method: GET
Request URL: http://viherio.freebsd/admin/cms/page/3/edit-plugin/14/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.formtools',
'django.contrib.syndication',
'django.contrib.markup',
'tinymce',
'filebrowser',
'journal',
'comments',
'tagging',
'chunks',
'multilingual',
'cms',
'cms.plugins.text',
'cms.plugins.picture',
'cms.plugins.link',
'cms.plugins.file',
'mptt']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'multilingual.middleware.DefaultLanguageMiddleware',
'cms.middleware.CurrentPageMiddleware',
'cms.middleware.MultilingualURLMiddleware')
Traceback:
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response
86. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/sites.py" in root
157. return self.model_page(request, *url.split('/', 2))
File "/usr/local/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/sites.py" in model_page
176. return admin_obj(request, rest_of_url)
File "/usr/local/www/django/lib/cms/admin/__init__.py" in __call__
95. return edit_plugin(request, plugin_id, self.admin_site)
File "/usr/local/www/django/lib/cms/admin/views.py" in edit_plugin
89. instance, admin = cms_plugin.get_plugin_instance(admin_site)
File "/usr/local/www/django/lib/cms/models/__init__.py" in get_plugin_instance
441. plugin = plugin_pool.get_plugin(self.plugin_type)(*args, **kwargs)
Exception Type: TypeError at /admin/cms/page/3/edit-plugin/14/
Exception Value: multilingual_modeladmin_new() takes at least 3 arguments (2 given)
a dropdown in the admin-list view with all the sites and some ajax helps if you have a lot of sites.
I have never been able to get plugins within Text working in CMS 2. I am currently using the latest version from github, with the master branch (though I've tried both textobjects and django1.1 branches also to no avail). I've tested it with Django r9505, 1.0.2, r9999, and latest trunk, but without success.
Under Django r9505 and 1.0.2, a DoesNotExist is raised when attempting to save the nested plugin: http://dpaste.com/hold/42866/
Under Django r9999 / latest trunk (if you apply the fix described in my previous email), the popup that appears refuses to close or report back to the main page. It just states that the new plugin was added successfully, and stays open for further editing. Closing it does not update the text object.
Does anyone have this working? Which versions/branches are you using?
support for django.contrib.sitemaps
there should be a way to inherit the plugins of parent pages or the other way around.
after some projects with wymeditor we came to the conclusion that wymeditor sucks!
We need a replacement for it.
If you store the media on a different domain the rich text editor causes a JavaScript editor when it attempts to load the HTML file.
You can repeat this by doing the following. If the following config for the site/media; site_root – www.mydomain.com media_url – media.mydomain.com admin_media = admin.mydomain.com
Then when you go to the admin and add a text plugin, trying to edit will cause a JavaScript error a request is being made from www.mydomain.com to media.mydomain.com . This is a problem since cross domain requests are not allowed for security reasons. Change History (follow-up: ↓ 2 ) 03/30/09 13:28:32 changed by divio ¶
how does the normal admin handles this issue with the javascript files it loads? (in reply to: ↑ 1 ) 04/04/09 19:45:01 changed by guest ¶
Replying to divio:
how does the normal admin handles this issue with the javascript files it loads?
contrib.admin doesn’t user any Ajax so cross domain issues are not well an issue. 04/06/09 16:17:18 changed by divio ¶
how do you handle this if you use ajax anywhere on your site?
If you add a page placeholders should be filled with default plugins
South has a bug ( http://south.aeracode.org/ticket/125 ) that affects altering PositiveIntegerFields and PositiveSmallIntegerFields. A temp workaround is to replace them with IntegerFields and SmallIntegerFields. Like this:
diff --git a/cms/migrations/0004_textobjects.py b/cms/migrations/0004_textobjects.py
index 8239461..7b14b50 100644
--- a/cms/migrations/0004_textobjects.py
+++ b/cms/migrations/0004_textobjects.py
@@ -8,7 +8,7 @@ class Migration:
def forwards(self, orm):
# Adding field 'CMSPlugin.position'
db.alter_column('cms_cmsplugin', 'position', models.PositiveSmallIntegerField(_("position"), null=True, editable=False, blank=True))
db.alter_column('cms_cmsplugin', 'position', models.SmallIntegerField(_("position"), null=True, editable=False, blank=True))
# Adding field 'CMSPlugin.parent'
db.add_column('cms_cmsplugin', 'parent', models.ForeignKey(orm.CMSPlugin, null=True, editable=False, blank=True))
@@ -18,7 +18,7 @@ class Migration:
def backwards(self, orm):
# Deleting field 'CMSPlugin.position'
db.alter_column('cms_cmsplugin', 'position', models.PositiveSmallIntegerField(_("position"), default=0, editable=False))
db.alter_column('cms_cmsplugin', 'position', models.SmallIntegerField(_("position"), default=0, editable=False))
# Deleting field 'CMSPlugin.parent'
db.delete_column('cms_cmsplugin', 'parent_id')
If I create a page and leave the slug blank, the following exception is raised. Furthermore, the page
Environment: Request Method: POST Request URL: http://localhost:8000/admin/cms/page/1/?language=en& Django Version: 1.1 beta 1 SVN-10755 Python Version: 2.5.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'django_evolution', 'django_extensions', 'cms', 'cms.plugins.text', 'cms.plugins.picture', 'cms.plugins.file', 'mptt', 'reversion'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware', 'django.contrib.csrf.middleware.CsrfMiddleware', 'cms.middleware.CurrentPageMiddleware') Traceback: File "/home/simon/.pythonpath/django/core/handlers/base.py" in get_response 92. response = callback(request, *callback_args, **callback_kwargs) File "/home/simon/.pythonpath/django/contrib/admin/sites.py" in root 480. return self.model_page(request, *url.split('/', 2)) File "/home/simon/.pythonpath/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "/home/simon/.pythonpath/django/contrib/admin/sites.py" in model_page 499. return admin_obj(request, rest_of_url) File "/home/meers/.pythonpath/cms_versions/2/cms/admin/__init__.py" in __call__ 114. return super(PageAdmin, self).__call__(request, url) File "/home/simon/.pythonpath/reversion/admin.py" in __call__ 85. return super(VersionAdmin, self).__call__(request, url) File "/home/simon/.pythonpath/django/contrib/admin/options.py" in __call__ 1094. return self.change_view(request, unquote(url)) File "/home/meers/.pythonpath/cms_versions/2/cms/admin/__init__.py" in change_view 266. return super(PageAdmin, self).change_view(request, object_id, extra_context) File "/home/simon/.pythonpath/django/db/transaction.py" in _commit_on_success 240. res = func(*args, **kw) File "/home/simon/.pythonpath/reversion/revisions.py" in _create_on_success 177. result = func(*args, **kwargs) File "/home/simon/.pythonpath/django/db/transaction.py" in _commit_on_success 240. res = func(*args, **kw) File "/home/simon/.pythonpath/django/contrib/admin/options.py" in change_view 812. if form.is_valid(): File "/home/simon/.pythonpath/django/forms/forms.py" in is_valid 120. return self.is_bound and not bool(self.errors) File "/home/simon/.pythonpath/django/forms/forms.py" in _get_errors 111. self.full_clean() File "/home/simon/.pythonpath/django/forms/forms.py" in full_clean 250. self.cleaned_data = self.clean() File "/home/meers/.pythonpath/cms_versions/2/cms/admin/forms.py" in clean 29. slug = cleaned_data['slug'] Exception Type: KeyError at /admin/cms/page/1/ Exception Value: 'slug'
Placeholder seems to merrily iterate through all plugins whilst rendering without checking whether some of them are actually embedded within others! For efficiency, it would probably be best to add an 'embedded' or 'nested' boolean field to the CMSPlugin class which can be set upon creation, however for now I have implemented a quick hack to get around it on my system:
diff --git a/cms/templatetags/cms_tags.py b/cms/templatetags/cms_tags.py index afc34e2..22d2281 100644 --- a/cms/templatetags/cms_tags.py +++ b/cms/templatetags/cms_tags.py @@ -387,7 +387,18 @@ class PlaceholderNode(template.Node): else: plugins = CMSPlugin.objects.filter(page=page, language=l, placehold c = "" + + nested_ids = [] + from cms.plugins.text.utils import OBJ_ADMIN_RE + for plugin in plugins: + i = plugin.get_plugin_instance()[0] + if getattr(i, 'body', False): + for m in OBJ_ADMIN_RE.findall(i.body): + nested_ids.append(int(m)) + for plugin in plugins: + # check that it's not already nested + if plugin.id in nested_ids: continue c += plugin.render_plugin(context, self.name) if not c: return ''
Example:
In my app, I specified the "Sample Application" to be available on my "Home" page, which is first in the tree.
If I hit "/" I do not see the {{ message }} output in the template.
If I hit "/home/" I do.
Content authors are faced with two Save buttons: one for the content editor they are using, and one for the page as a whole.
It may help the content author if the content editor appeared in a new pop-up window for editing:
The max_length for application_urls is only 32 character which is way too short for long module names or encapsulated modules (think Satchmo and other complex projects). The maximal path should be at least 200 characters long.
Enabling the CSRF Middleware breaks the following on the admin site:
- Published/In Navigation Checkboxes
- Cut/Paste (moving pages)
- Drag and drop (moving pages)
Because these post to the server, they need to include a token from the CSRF Middleware (if it is enabled). If they do not, the result is a 403 Forbidden.
There should be a possibility to setup redirects.
I would propose a new model called redirects... with a from_url and to_url and an optional page
Some plugins have Save buttons in grey, on the left (file, image from image filer). Others are are blue, and on the right (text). This should be standardised for the user's sake.
1. Add plugin to page 2. start editing plugin 3. delete plugin on the left 4. click save to save changes to the plugin 5. observe 404 error
:) Doesn’t actually break anything, but would be confusing for a user.
Fix could close the editor?
I think it's not good to show pages that do not have content in the currently selected language in the navigation. Some times people want to not publish all information in all languages.
I came up with a quick hack to accomplish this. I replaced lines 88 - 96 in templatetags/cms_tags.py with the following code:
other_children = []
for page in children:# add the title and slugs and some meta data
for title in titles:
if title.page_id == page.pk:
page.title_cache = title
other_children.append(page)
#titles.remove(title)
if page.pk in ancestors:
page.ancestor = True
if current_page and page.parent_id == current_page.parent_id and not page.pk == current_page.pk:
page.sibling = True
and then provide other_children list in the context instead of children list:
context.update({'children':other_children,
'template':template,
'from_level':from_level,
'to_level':to_level,
'extra_inactive':extra_inactive,
'extra_active':extra_active})
I know this is a quick ugly hack, but I think it'd be a good thing to implement. Maybe as an attribute for the template tag?
I'm working with svn revision 289, so forgive me if this is fixed.
I've set; CMS_UNIQUE_SLUGS = False
Children from different parents can have the same slug. However, children cannot have slugs the same as their parent or another parent. in these cases the message about another page existing with the slug is shown.
So to demonstrate this with the generated URLs. This is ok;
parent1/slug-name/
parent2/slug-name/
this doesn't seem to be allowed;
parent1/slug-name/
parent2/parent1/
reverse is not working if a page is published after an apphook was installed.
A restart of the server is needed to make it work.
plugins should be able to be inserted into the text-plugins text (link, picture)
there is no validation that if you move an item in the tree that siblings have the same slug.
So it can be used in other apps such as:
News, Blogs etc.
If the server is running and you change the name and/or address of the site object for the current site 404’s are returned.
Restarting the server seems to fix this.
Tested on the django dev server.
In Firefox, if you drag an image that represents a plugin object around, and then press 'Edit selected object', you get a prompt saying "no object selected"
This apparently occurs because in Firefox events that have been attached to the image object are lost when the object is moved around like this. WymEditor relies on these events to know when an image has been selected, and the "edit selected object" button relies on WymEditor for this. This is essentially a browser bug.
I do have a patch for WymEditor that does fix it, by binding to the dragdrop event and running a function immediately afterwards to re-instate the event handlers. I don't know if we want to go down the road of patching WymEditor though.
applications with theire urls.py can be attached to a page. reverse and urls handling is then controlled by which page the application is connected to.
An app hooked into a page is only going to work on a main-level page, but not on a sub-level page.
-startsite (<= ok)
-information (<= ok)
--our blogs (<= not working)
There is no error message or any other output that might lead to a solution.
EDIT:
I just digged a bit into the code and it seems that the menuitem is generated the wrong way.
The page structure is:
-startsite
-informationen
--blogs
The generated "blogs"-menuitem is "blogs/" instead of "informationen/blogs/"... if I change the url to the right direction, than the app gets loaded.
Plugin Forms are not rendered with the admin at the moment. So using Admin-Widgets gets possible with this.
the plugin way is too restrictive and doesn't work well for 3th party plugins
allow plugin groups to be specified in the settings. These plgin groups can then be used in the placeholder, to tie the placehodler to specific plugins (plugin groups).
implement the urls handling as follows for the cms/admin:
def get_urls(self):
urls = super(MyModelAdmin, self).get_urls()
my_urls = patterns('',
(r'^my_view/$', self.my_view)
)
return my_urls + urls
in the mean time... till this bug is fixed:
use (r'^admin/(.*)', admin.site.root), in your urls.py
Plugins should be organized in a tree so more complex stuff can happen
inline management of rights
approval of changes
role based
at the moment only the text plugin is searched in the admin. A search api for other plugins is needed.
Using the latest version of Django trunk, with or without the django1.1 branch of CMS 2 checked out, it is impossible to edit plugins. An AttributeError is raised ('int' object has no attribute 'split') because admin.change_view is expecting a string, and tried to "unquote" it. Changing cms/admin/views.py L141 to
response = admin.change_view(request, str(plugin_id))
fixes this problem. Perhaps this patch should be added to the django1.1 branch? (Though it appears to be safely backward compatible anyway, so could be applied to the master branch)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.