Skip to content

Instantly share code, notes, and snippets.

Avatar

Paulo Alvarado czpython

View GitHub Profile
View render_plugin.py
from django.contrib.auth.models import AnonymousUser
from django.test.client import RequestFactory
from sekizai.context import SekizaiContext
from cms.toolbar.toolbar import CMSToolbar
def get_request(path='/'):
request = RequestFactory().get(path)
request.current_page = None
request.session = {'cms_edit': False}
View keybase.md

Keybase proof

I hereby claim:

  • I am czpython on github.
  • I am czpython (https://keybase.io/czpython) on keybase.
  • I have a public key ASBm_w1_0dKMIAQ6fdfQff8rBQkC1_W53yll1Qb6jCY1rQo

To claim this, I am signing this object:

View check_for_bad_numchild.py
# -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand
from cms.models import CMSPlugin
MESSAGE = """
Found {} corrupt plugins.
Here's their ids:
{}
View list_parent_language_plugin_corruptions.py
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.management.base import NoArgsCommand
from cms.models import CMSPlugin, Page
class Command(NoArgsCommand):
help = 'Lists plugins whose parent language does not match.'
View fix_parent_placeholder_plugin_corruption.py
# -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand
from cms.models import CMSPlugin
class Command(NoArgsCommand):
help = 'Fixes plugins whose parent is in another placeholder'
def handle_noargs(self, **options):
View list_plugins_with_bad_language.py
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.management.base import NoArgsCommand
from cms.models import CMSPlugin, Page
class Command(NoArgsCommand):
def get_corrupt_parent_plugins(self):
View fix_corrupt_child_plugins.py
# -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand
from cms.models import CMSPlugin
class Command(NoArgsCommand):
help = 'Fixes plugins whose parent is in another placeholder'
def handle_noargs(self, **options):
@czpython
czpython / use_new_style_plugin_table_names.py
Last active Nov 13, 2015
Migrates old cms plugin table to new table
View use_new_style_plugin_table_names.py
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import connection, models
class Migration(DataMigration):
tables = {
'old_cmsplugin_table_name': 'new_table_name',
@czpython
czpython / view_migration_changes.py
Last active Aug 29, 2015
Script to view any missing migrations for models. Will not work with native django migrations
View view_migration_changes.py
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from django.conf import settings
from django.core.management.base import NoArgsCommand
from south.exceptions import NoMigrations
from south.migration import Migrations
View current_stack_print.py
import traceback
def view_current_stack():
for line in traceback.format_stack():
print line.strip()
You can’t perform that action at this time.