This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.core.management.commands import loaddata | |
from django.db.models import signals | |
class Command(loaddata.Command): | |
def handle(self, *fixture_labels, **options): | |
from cms.signals import update_placeholders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.views.generic import ListView | |
class SortableListView(ListView): | |
allowed_sort_fields = () | |
sort_default = None | |
sort_key = 'sort' | |
sort_field_splitter = '-' | |
sort_ascending_postfix = 'up' | |
sort_descending_postfix = 'down' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "plugin.h" | |
PLUGIN_HEADER | |
/* variable button definitions */ | |
#if CONFIG_KEYPAD == RECORDER_PAD | |
#define GOL_QUIT BUTTON_OFF | |
#define GOL_UP BUTTON_UP | |
#define GOL_DOWN BUTTON_DOWN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from project.utils import classmaker | |
class Category(TranslatableModel, MPTTModel): | |
# https://github.com/ojii/django-nani/issues/39 | |
__metaclass__ = classmaker() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# modified version of http://tomforb.es/using-python-metaclasses-to-make-awesome-django-model-field-choices | |
# that preserves order of definition | |
import inspect, itertools | |
class Option(object): | |
_counter = itertools.count() | |
def __init__(self, value, verbose_name=None): | |
self._count = Option._counter.next() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT "cms_title"."id", | |
"cms_title"."language", | |
"cms_title"."title", | |
"cms_title"."menu_title", | |
"cms_title"."slug", | |
"cms_title"."path", | |
"cms_title"."has_url_overwrite", | |
"cms_title"."application_urls", | |
"cms_title"."redirect", | |
"cms_title"."meta_description", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@register.filter | |
def unescape(value): | |
""" | |
Removes HTML or XML character references and entities from a text string. | |
# | |
@param text The HTML (or XML) source text. | |
@return The plain text, as a Unicode string, if necessary. | |
""" | |
def fixup(m): | |
text = m.group(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModelAdmin(TranslatableAdmin) | |
list_display = ('title', 'is_published') | |
use_fieldsets = ( | |
(_("Common"), { | |
'fields': (('is_published',) | |
}), | |
(_("Language dependent"), { | |
'fields': ('name', 'slug',), | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# For Ubuntu 8.x and 9.x releases. | |
if [ -d "/usr/share/postgresql-8.3-postgis" ] | |
then | |
POSTGIS_SQL_PATH=/usr/share/postgresql-8.3-postgis | |
POSTGIS_SQL=lwpostgis.sql | |
GEOGRAPHY=0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
from optparse import make_option | |
import polib | |
from django.core.management import CommandError | |
from django.core.management.base import AppCommand | |