Permalink
Browse files

migrations, docs, cleanup

  • Loading branch information...
1 parent 111d806 commit b64f92afb4d14dd56773083176fef4627e8e915b @digi604 committed Oct 19, 2012
@@ -129,8 +129,8 @@ def __reduce__(self):
factory = simple_class_factory
return (model_unpickle, (model, defers, factory), data)
- #def __unicode__(self):
- # return unicode(self.id)
+ def __unicode__(self):
+ return unicode(self.id)
def get_plugin_name(self):
from cms.plugin_pool import plugin_pool
@@ -1 +0,0 @@
-__author__ = 'patricklauber'
@@ -0,0 +1,66 @@
+# -*- coding: 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 'MultiColumns'
+ db.create_table('cmsplugin_multicolumns', (
+ ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
+ ))
+ db.send_create_signal('column', ['MultiColumns'])
+
+ # Adding model 'Column'
+ db.create_table('cmsplugin_column', (
+ ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
+ ('width', self.gf('django.db.models.fields.CharField')(default=1, max_length=50)),
+ ))
+ db.send_create_signal('column', ['Column'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'MultiColumns'
+ db.delete_table('cmsplugin_multicolumns')
+
+ # Deleting model 'Column'
+ db.delete_table('cmsplugin_column')
+
+
+ models = {
+ 'cms.cmsplugin': {
+ 'Meta': {'object_name': 'CMSPlugin'},
+ 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ '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.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'})
+ },
+ 'column.column': {
+ 'Meta': {'object_name': 'Column', 'db_table': "'cmsplugin_column'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
+ 'width': ('django.db.models.fields.CharField', [], {'default': '1', 'max_length': '50'})
+ },
+ 'column.multicolumns': {
+ 'Meta': {'object_name': 'MultiColumns', 'db_table': "'cmsplugin_multicolumns'", '_ormbases': ['cms.CMSPlugin']},
+ 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'})
+ }
+ }
+
+ complete_apps = ['column']
@@ -1,6 +1,17 @@
from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
+from django.conf import settings
+
+if hasattr(settings, "COLUMN_WIDTH_CHOICES"):
+ WIDTH_CHOICES = settings.COLUMN_WIDTH_CHOICES
+else:
+ WIDTH_CHOICES = (
+ ('1', _("normal")),
+ ('2', _("2x")),
+ ('3', _("3x")),
+ ('4', _("4x"))
+ )
class MultiColumns(CMSPlugin):
"""
@@ -13,11 +24,6 @@ class Column(CMSPlugin):
"""
A Column for the MultiColumns Plugin
"""
- WIDTH_CHOICES = (
- (1, _("normal")),
- (2, _("2x")),
- (3, _("3x")),
- (4, _("4x"))
- )
- width = models.PositiveSmallIntegerField(_("width"), choices=WIDTH_CHOICES, default=1)
+
+ width = models.CharField(_("width"), choices=WIDTH_CHOICES, default=WIDTH_CHOICES[0][0], max_length=50)
@@ -1,6 +1,5 @@
-{% load cms_tags i18n %}
-<div style="width: {{ instance.width }}00px;">
+{% load cms_tags %}
{% for plugin in instance.childrens %}
{% render_plugin plugin %}
{% endfor %}
-</div>
+
@@ -1,6 +1,8 @@
-{% load cms_tags i18n %}
+{% load cms_tags %}
<div class="multicolumn">
{% for plugin in instance.childrens %}
- {% render_plugin plugin %}
+ <div style="width: {{ plugin.width }}00px;">
+ {% render_plugin plugin %}
+ </div>
{% endfor %}
</div>
@@ -2,18 +2,20 @@
Template Tags
#############
+CMS templatetags
+================
+
.. highlightlang:: html+django
To use any of the following templatetags you first need to load them at the
top of your template::
- {% load cms_tags menu_tags %}
+ {% load cms_tags %}
.. templatetag:: placeholder
-***********
placeholder
-***********
+-----------
.. versionchanged:: 2.1
The placeholder name became case sensitive.
@@ -63,9 +65,9 @@ context variables and change some other placeholder behavior.
.. templatetag:: show_placeholder
-****************
+
show_placeholder
-****************
+----------------
Displays a specific placeholder from a given page. This is useful if you want
to have some more or less static content that is shared among many pages, such
@@ -84,8 +86,8 @@ Examples::
{% show_placeholder "content" request.current_page.parent_id %}
{% show_placeholder "teaser" request.current_page.get_root %}
-Page Lookup
-===========
+page_lookup
+-----------
The ``page_lookup`` argument, passed to several templatetags to retrieve a
page, can be of any of the following types:
@@ -126,9 +128,8 @@ inherit the content of its root-level ancestor::
.. templatetag:: show_uncached_placeholder
-*************************
show_uncached_placeholder
-*************************
+-------------------------
The same as :ttag:`show_placeholder`, but the placeholder contents will not be
cached.
@@ -146,9 +147,9 @@ Example::
.. templatetag:: page_url
-********
+
page_url
-********
+--------
Displays the URL of a page in the current language.
@@ -163,9 +164,8 @@ Example::
.. templatetag:: page_attribute
-**************
page_attribute
-**************
+--------------
This templatetag is used to display an attribute of the current page in the
current language.
@@ -210,11 +210,49 @@ Example::
{% page_attribute "page_title" "my_page_reverse_id" as title %}
<a href="/mypage/">{{ title }}</a>
+.. templatetag:: render_plugin
+.. versionadded:: 2.4
+
+render_plugin
+-------------
+
+This templatetag is used to render child plugins of the current plugin and should be used inside plugin templates.
+
+Arguments:
+
+- ``plugin``
+
+Plugin needs to be an instance of a plugin model.
+
+Example::
+
+ {% load cms_tags %}
+ <div class="multicolumn">
+ {% for plugin in instance.childrens %}
+ <div style="width: {{ plugin.width }}00px;">
+ {% render_plugin plugin %}
+ </div>
+ {% endfor %}
+ </div>
+
+Normally the childrens of plugins can be accessed via the ``childrens`` atrribute of plugins.
+Plugins need the ``allow_children`` attribute to set to `True` for this to be enabled.
+
+
+Menu Templatetags
+=================
+
+.. highlightlang:: html+django
+
+To use any of the following templatetags you first need to load them at the
+top of your template::
+
+ {% load menu_tags %}
+
.. templatetag:: show_menu
-*********
show_menu
-*********
+---------
The ``show_menu`` tag renders the navigation of the current page. You can
overwrite the appearance and the HTML if you add a ``cms/menu.html`` template
@@ -234,8 +272,8 @@ descendant of the current active node.
Finally, the fourth parameter, ``extra_active`` (default=100), specifies how
many levels of descendants of the currently active node should be displayed.
-Some Examples
-=============
+show_menu Examples
+------------------
Complete navigation (as a nested list)::
@@ -268,9 +306,8 @@ Navigation with a custom template::
.. templatetag:: show_menu_below_id
-******************
show_menu_below_id
-******************
+------------------
If you have set an id in the advanced settings of a page, you can display the
submenu of this page with a template tag. For example, we have a page called
@@ -288,9 +325,8 @@ You can give it the same optional parameters as ``show_menu``::
.. templatetag:: show_sub_menu
-*************
show_sub_menu
-*************
+-------------
Displays the sub menu of the current page (as a nested list).
Takes one argument that specifies how many levels deep the submenu should be
@@ -308,9 +344,8 @@ Or with a custom template::
.. templatetag:: show_breadcrumb
-***************
show_breadcrumb
-***************
+---------------
Renders the breadcrumb navigation of the current page.
The template for the HTML can be found at ``cms/breadcrumb.html``::
@@ -349,9 +384,9 @@ And then in your app template::
.. templatetag:: page_language_url
-*****************
+
page_language_url
-*****************
+-----------------
Returns the url of the current page in an other language::
@@ -367,9 +402,9 @@ For more information, see :doc:`i18n`.
.. templatetag:: language_chooser
-****************
+
language_chooser
-****************
+----------------
The ``language_chooser`` template tag will display a language chooser for the
current page. You can modify the template in ``menu/language_chooser.html`` or
@@ -399,11 +434,20 @@ function with the set_language_changer function in menus.utils.
For more information, see :doc:`i18n`.
+Toolbar Templatetags
+====================
+
+.. highlightlang:: html+django
+
+To use any of the following templatetags you first need to load them at the
+top of your template::
+
+ {% load cms_toolbar %}
+
.. templatetag:: cms_toolbar
-***********
cms_toolbar
-***********
+-----------
The ``cms_toolbar`` templatetag will add the required css and javascript to the
sekizai blocks in the base template. The templatetag has to be placed after the
Oops, something went wrong.

0 comments on commit b64f92a

Please sign in to comment.