Skip to content

Commit

Permalink
Merge branch 'develop' into columns-plugin
Browse files Browse the repository at this point in the history
Conflicts:
	docs/upgrade/2.4.rst
  • Loading branch information
digi604 committed Oct 19, 2012
2 parents 7908842 + af529e6 commit d60e754
Show file tree
Hide file tree
Showing 114 changed files with 14,314 additions and 10,550 deletions.
7 changes: 4 additions & 3 deletions cms/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def clean(self):
#AdminFormsTests.test_clean_overwrite_url validates the form with when no page instance available
#Looks like just a theoretical corner case
title = page.get_title_obj(lang)
if title:
if title and slug:
oldslug = title.slug
title.slug = slug
title.save()
Expand All @@ -122,8 +122,9 @@ def clean(self):
except ValidationError,e:
title.slug = oldslug
title.save()
del cleaned_data['published']
self._errors['published'] = ErrorList(e.messages)
if 'slug' in cleaned_data:
del cleaned_data['slug']
self._errors['slug'] = ErrorList(e.messages)
return cleaned_data

def clean_slug(self):
Expand Down
24 changes: 23 additions & 1 deletion cms/admin/placeholderadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,29 @@ def edit_plugin(self, request, plugin_id):
post_request = request.POST.copy()
post_request['_continue'] = True
request.POST = post_request


if request.POST.get("_cancel", False):
# cancel button was clicked
context = {
'CMS_MEDIA_URL': settings.CMS_MEDIA_URL,
'plugin': cms_plugin,
'is_popup': True,
'name': unicode(cms_plugin),
"type": cms_plugin.get_plugin_name(),
'plugin_id': plugin_id,
'icon': force_escape(escapejs(cms_plugin.get_instance_icon_src())),
'alt': force_escape(escapejs(cms_plugin.get_instance_icon_alt())),
'cancel': True,
}
instance = cms_plugin.get_plugin_instance()[0]
if not instance:
# cancelled before any content was added to plugin
cms_plugin.delete()
context.update({
"deleted":True,
})
return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))

if not instance:
# instance doesn't exist, call add view
response = plugin_admin.add_view(request)
Expand Down
469 changes: 364 additions & 105 deletions cms/migrations/0001_initial.py

Large diffs are not rendered by default.

407 changes: 333 additions & 74 deletions cms/migrations/0002_auto_start.py

Large diffs are not rendered by default.

364 changes: 346 additions & 18 deletions cms/migrations/0003_remove_placeholder.py

Large diffs are not rendered by default.

413 changes: 333 additions & 80 deletions cms/migrations/0004_textobjects.py

Large diffs are not rendered by default.

423 changes: 333 additions & 90 deletions cms/migrations/0005_mptt_added_to_plugins.py

Large diffs are not rendered by default.

463 changes: 333 additions & 130 deletions cms/migrations/0006_apphook.py

Large diffs are not rendered by default.

409 changes: 333 additions & 76 deletions cms/migrations/0007_apphook_longer.py

Large diffs are not rendered by default.

415 changes: 334 additions & 81 deletions cms/migrations/0008_redirects.py

Large diffs are not rendered by default.

419 changes: 334 additions & 85 deletions cms/migrations/0009_added_meta_fields.py

Large diffs are not rendered by default.

420 changes: 333 additions & 87 deletions cms/migrations/0010_5char_language.py

Large diffs are not rendered by default.

418 changes: 332 additions & 86 deletions cms/migrations/0011_title_overwrites.py

Large diffs are not rendered by default.

766 changes: 325 additions & 441 deletions cms/migrations/0012_publisher.py

Large diffs are not rendered by default.

528 changes: 326 additions & 202 deletions cms/migrations/0013_site_copy.py

Large diffs are not rendered by default.

529 changes: 326 additions & 203 deletions cms/migrations/0014_sites_removed.py

Large diffs are not rendered by default.

553 changes: 325 additions & 228 deletions cms/migrations/0015_modified_by_added.py

Large diffs are not rendered by default.

532 changes: 326 additions & 206 deletions cms/migrations/0016_author_copy.py

Large diffs are not rendered by default.

533 changes: 326 additions & 207 deletions cms/migrations/0017_author_removed.py

Large diffs are not rendered by default.

534 changes: 326 additions & 208 deletions cms/migrations/0018_site_permissions.py

Large diffs are not rendered by default.

540 changes: 326 additions & 214 deletions cms/migrations/0019_public_table_renames.py

Large diffs are not rendered by default.

585 changes: 326 additions & 259 deletions cms/migrations/0020_advanced_permissions.py

Large diffs are not rendered by default.

698 changes: 314 additions & 384 deletions cms/migrations/0021_publisher2.py

Large diffs are not rendered by default.

465 changes: 315 additions & 150 deletions cms/migrations/0022_login_required_added.py

Large diffs are not rendered by default.

449 changes: 312 additions & 137 deletions cms/migrations/0023_plugin_table_naming_function_changed.py

Large diffs are not rendered by default.

455 changes: 294 additions & 161 deletions cms/migrations/0024_added_placeholder_model.py

Large diffs are not rendered by default.

485 changes: 299 additions & 186 deletions cms/migrations/0025_placeholder_migration.py

Large diffs are not rendered by default.

448 changes: 296 additions & 152 deletions cms/migrations/0026_finish_placeholder_migration.py

Large diffs are not rendered by default.

441 changes: 298 additions & 143 deletions cms/migrations/0027_added_width_to_placeholder.py

Large diffs are not rendered by default.

430 changes: 292 additions & 138 deletions cms/migrations/0028_limit_visibility_in_menu_step1of3.py

Large diffs are not rendered by default.

442 changes: 296 additions & 146 deletions cms/migrations/0029_limit_visibility_in_menu_step2of3_data.py

Large diffs are not rendered by default.

431 changes: 294 additions & 137 deletions cms/migrations/0030_limit_visibility_in_menu_step3of3.py

Large diffs are not rendered by default.

435 changes: 293 additions & 142 deletions cms/migrations/0031_improved_language_code_support.py

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

429 changes: 293 additions & 136 deletions cms/migrations/0036_auto__add_field_cmsplugin_changed_date.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cms/models/pluginmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.conf import settings
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db import models
from django.db.models.base import (model_unpickle, simple_class_factory)
from django.db.models.base import model_unpickle
from django.db.models.query_utils import DeferredAttribute
from django.utils.translation import ugettext_lazy as _

Expand Down Expand Up @@ -126,7 +126,7 @@ def __reduce__(self):
obj = self.__class__.__dict__[field.attname]
model = obj.model_ref()
else:
factory = simple_class_factory
factory = lambda x, y: x
return (model_unpickle, (model, defers, factory), data)

def __unicode__(self):
Expand Down
13 changes: 8 additions & 5 deletions cms/plugin_base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
import re
from cms.exceptions import SubClassNeededError, Deprecated
from cms.models import CMSPlugin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import ImproperlyConfigured
from django.db.models.options import get_verbose_name
from django.forms.models import ModelForm
from django.utils.encoding import smart_str
from django.utils.translation import ugettext_lazy as _
Expand Down Expand Up @@ -71,7 +71,7 @@ def __new__(cls, name, bases, attrs):
]
# Set default name
if not new_plugin.name:
new_plugin.name = get_verbose_name(new_plugin.__name__)
new_plugin.name = re.sub("([a-z])([A-Z])","\g<1> \g<2>", name)
return new_plugin


Expand All @@ -84,7 +84,7 @@ class CMSPluginBase(admin.ModelAdmin):
change_form_template = "admin/cms/page/plugin_change_form.html"
frontend_edit_template = 'cms/toolbar/placeholder_wrapper.html'
# Should the plugin be rendered in the admin?
admin_preview = True
admin_preview = False

render_template = None

Expand Down Expand Up @@ -112,8 +112,11 @@ def __init__(self, model=None, admin_site=None):
self.placeholder = None
self.page = None


def render(self, context, instance, placeholder):
raise NotImplementedError("render needs to be implemented")
context['instance'] = instance
context['placeholder'] = placeholder
return context

@property
def parent(self):
Expand Down Expand Up @@ -240,4 +243,4 @@ def pluginmedia(self):
def get_plugin_media(self, request, context, plugin):
raise Deprecated(
"CMSPluginBase.get_plugin_media is deprecated in favor of django-sekizai"
)
)
68 changes: 40 additions & 28 deletions cms/plugins/file/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,55 @@

# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from cms.plugins.file.models import *

class Migration:

depends_on = (
("cms", "0001_initial"),
)

class Migration(SchemaMigration):

def forwards(self, orm):

# Adding model 'File'
db.create_table('file_file', (
('cmsplugin_ptr', models.OneToOneField(orm['cms.CMSPlugin'])),
('file', models.FileField(_("file"), upload_to=CMSPlugin.get_media_path)),
('title', models.CharField(_("title"), max_length=255, null=True, blank=True)),
db.create_table('cmsplugin_file', (
('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
('file', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
('title', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)),
))
db.send_create_signal('file', ['File'])





def backwards(self, orm):

# Deleting model 'File'
db.delete_table('file_file')



db.delete_table('cmsplugin_file')


models = {
'cms.cmsplugin': {
'_stub': True,
'id': ('models.AutoField', [], {'primary_key': 'True'})
'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.page': {
'Meta': {'ordering': "('tree_id','lft')"},
'_stub': True,
'id': ('models.AutoField', [], {'primary_key': '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'})
},
'file.file': {
'Meta': {'object_name': 'File', 'db_table': "'cmsplugin_file'", '_ormbases': ['cms.CMSPlugin']},
'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
}
}


complete_apps = ['file']
46 changes: 29 additions & 17 deletions cms/plugins/file/migrations/0002_freeze.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@

# -*- coding: utf-8 -*-
from south.db import db
from django.db import models
from cms.plugins.file.models import *

class Migration:

def forwards(self, orm):
"Write your forwards migration here"


def backwards(self, orm):
"Write your backwards migration here"



models = {
'file.file': {
'cmsplugin_ptr': ('models.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
'file': ('models.FileField', [], {'max_length': '100'}),
'title': ('models.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
},
'cms.cmsplugin': {
'_stub': True,
'id': ('models.AutoField', [], {'primary_key': 'True', 'blank': 'True'})
'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'})
},
'cms.page': {
'_stub': True,
'id': ('models.AutoField', [], {'primary_key': 'True', 'blank': 'True'})
'file.file': {
'Meta': {'object_name': 'File', 'db_table': "'cmsplugin_file'", '_ormbases': ['cms.CMSPlugin']},
'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
}
}

complete_apps = ['file']
Loading

0 comments on commit d60e754

Please sign in to comment.