Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
digi604 committed Oct 25, 2012
1 parent e6a397a commit 619e219
Show file tree
Hide file tree
Showing 14 changed files with 347 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

[main]
host = https://www.transifex.com

[django-cms.djangocms-column]
file_filter = djangocms_column/locale/<lang>/LC_MESSAGES/django.po
source_file = djangocms_column/locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO

1 change: 1 addition & 0 deletions djangocms_column/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.0"
35 changes: 35 additions & 0 deletions djangocms_column/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from cms.plugins.column.models import MultiColumns, Column
from django.utils.translation import ugettext_lazy as _

class MultiColumnPlugin(CMSPluginBase):
model = MultiColumns
name = _("Multi Columns")
render_template = "cms/plugins/multi_column.html"
allow_children = True
child_classes = ["ColumnPlugin"]

def render(self, context, instance, placeholder):
context.update({
'instance': instance,
'placeholder':placeholder,
})
return context


class ColumnPlugin(CMSPluginBase):
model = Column
name = _("Column")
render_template = "cms/plugins/column.html"
allow_children = True

def render(self, context, instance, placeholder):
context.update({
'instance': instance,
'placeholder':placeholder,
})
return context

plugin_pool.register_plugin(MultiColumnPlugin)
plugin_pool.register_plugin(ColumnPlugin)
Binary file added djangocms_column/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
47 changes: 47 additions & 0 deletions djangocms_column/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: djangocms_column\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-25 11:18+0200\n"
"PO-Revision-Date: 2012-10-25 11:20+0100\n"
"Last-Translator: Patrick Lauber <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.5.3\n"
"Language: de\n"

#: cms_plugins.py:8
msgid "Multi Columns"
msgstr "Spalten"

#: cms_plugins.py:23
msgid "Column"
msgstr "Spalte"

#: models.py:10
msgid "normal"
msgstr "Normal"

#: models.py:11
msgid "2x"
msgstr "2x"

#: models.py:12
msgid "3x"
msgstr "3x"

#: models.py:13
msgid "4x"
msgstr "4x"

#: models.py:28
msgid "width"
msgstr "Breite"
46 changes: 46 additions & 0 deletions djangocms_column/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-10-25 11:18+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: cms_plugins.py:8
msgid "Multi Columns"
msgstr ""

#: cms_plugins.py:23
msgid "Column"
msgstr ""

#: models.py:10
msgid "normal"
msgstr ""

#: models.py:11
msgid "2x"
msgstr ""

#: models.py:12
msgid "3x"
msgstr ""

#: models.py:13
msgid "4x"
msgstr ""

#: models.py:28
msgid "width"
msgstr ""
66 changes: 66 additions & 0 deletions djangocms_column/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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']
Empty file.
29 changes: 29 additions & 0 deletions djangocms_column/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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):
"""
A plugin that has sub Column classes
"""
pass


class Column(CMSPlugin):
"""
A Column for the MultiColumns Plugin
"""

width = models.CharField(_("width"), choices=WIDTH_CHOICES, default=WIDTH_CHOICES[0][0], max_length=50)

5 changes: 5 additions & 0 deletions djangocms_column/templates/cms/plugins/column.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% load cms_tags %}
{% for plugin in instance.child_plugins %}
{% render_plugin plugin %}
{% endfor %}

8 changes: 8 additions & 0 deletions djangocms_column/templates/cms/plugins/multi_column.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% load cms_tags %}
<div class="multicolumn">
{% for plugin in instance.child_plugins %}
<div style="width: {{ plugin.width }}00px;">
{% render_plugin plugin %}
</div>
{% endfor %}
</div>
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
django-cms>=2.3
transifex-client
57 changes: 57 additions & 0 deletions schemamigration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys

INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'mptt',
'cms',
'menus',
'djangocms_column',
'south',
]

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}

TEMPLATE_CONTEXT_PROCESSORS = [
'django.core.context_processors.auth',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
]

ROOT_URLCONF = 'cms.urls'

def schemamigration():
# turn ``schemamigration.py --initial`` into
# ``manage.py schemamigration cmsplugin_disqus --initial`` and setup the
# enviroment
from django.conf import settings

from django.core.management import ManagementUtility
settings.configure(
INSTALLED_APPS=INSTALLED_APPS,
ROOT_URLCONF=ROOT_URLCONF,
DATABASES=DATABASES,
TEMPLATE_CONTEXT_PROCESSORS=TEMPLATE_CONTEXT_PROCESSORS
)
argv = list(sys.argv)
argv.insert(1, 'schemamigration')
argv.insert(2, 'djangocms_column')
utility = ManagementUtility(argv)
utility.execute()

if __name__ == "__main__":
schemamigration()
41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from djangocms_column import __version__


INSTALL_REQUIRES = [
'django-cms>=2.4',
]

CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Communications',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Message Boards',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
]

setup(
name='djangocms-column',
version=__version__,
description='Column Plugin for django CMS',
author='Divio AG',
author_email='[email protected]',
url='https://github.com/divio/djangocms-column',
packages=['djangocms_column', 'djangocms_column.migrations'],
install_requires=INSTALL_REQUIRES,
license='LICENSE.txt',
platforms=['OS Independent'],
classifiers=CLASSIFIERS,
long_description=open('README.md').read(),
include_package_data=True,
zip_safe=False
)

0 comments on commit 619e219

Please sign in to comment.