Skip to content

Instantly share code, notes, and snippets.

View pije76's full-sized avatar

panjianom pije76

View GitHub Profile
@pije76
pije76 / admin.py
Created October 29, 2012 05:07 — forked from uhop/admin.py
Adding Dojo's rich editor to Django's Admin.
# Example how to add rich editor capabilities to your models in admin.
from django.contrib.admin import site, ModelAdmin
import models
# we define our resources to add to admin pages
class CommonMedia:
js = (
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',
from django import template
import re
register = template.Library()
class_matcher = re.compile('(class="[^"]+)(")')
tag_matcher = re.compile(r'<([a-z0-9]+)([ >])')
def mark_current(navigation, current):
current_tokens = current.split('/')
@pije76
pije76 / feincms_ajax.js
Created October 29, 2012 16:49 — forked from schmidsi/feincms_ajax.js
FeinCMS ajax client side
var ajax_links_selector = 'a.ajax';
var content_selector = '#content';
var first_call = true;
var navilevel_substring = 3; // how many chars from pathname are static (3 for languagecode like /de/)
/* needs jquery address loaded: http://www.asual.com/jquery/address/
*
* needs feincms to be ajax-enabled:
*
* feincms/views/base.py:
@pije76
pije76 / multi_contact_form.py
Created October 29, 2012 16:50 — forked from mjtamlyn/multi_contact_form.py
Multi-contact form (FeinCMS content type)
from django.db import models
from django.utils.text import ugettext_lazy as _
from .contact_form_amended import ContactForm, ContactFormContent
class MultiContactFormContent(ContactFormContent):
FORM_CLASSES = {'simple-contact': ContactForm}
FORM_CHOICES = (('simple-contact', _('Simple contact form')),)
@pije76
pije76 / admin.menu.html
Created October 29, 2012 16:50 — forked from refik/admin.menu.html
feincms TreeEditor admin item
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us" >
<head>
<title>Select menu to change | Django site admin</title>
<meta name="robots" content="NONE,NOARCHIVE" />
<!-- STYLESHEETS -->
@pije76
pije76 / site.py
Created October 29, 2012 16:55 — forked from fiee/site.py
site dependency for FeinCMS pages (feincms.modules.page.extensions)
# -*- coding: utf-8 -*-
"""
Extension for FeinCMS Page
"""
from django.conf import settings
from django.db import models
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager
from django.utils.translation import ugettext_lazy as _
from feincms.module.page.models import Page, PageManager
@pije76
pije76 / appcontent.py
Created October 29, 2012 16:58 — forked from acdha/appcontent.py
Example of the new richer ApplicationContent type for FeinCMS - see http://github.com/acdha/feincms/tree/rich_appcontent
"""
Support for embedding blogs as FeinCMS ApplicationContent
"""
from django import forms
from .models import Blog
from .views import blog_detail
def get_admin_fields(form, *args, **kwargs):
@pije76
pije76 / feincms_ajax.js
Created October 29, 2012 17:00 — forked from schmidsi/feincms_ajax.js
FeinCMS ajax client side
var ajax_links_selector = 'a.ajax';
var content_selector = '#content';
var first_call = true;
var navilevel_substring = 3; // how many chars from pathname are static (3 for languagecode like /de/)
/* needs jquery address loaded: http://www.asual.com/jquery/address/
*
* needs feincms to be ajax-enabled:
*
* feincms/views/base.py:
@pije76
pije76 / settings.py
Created December 4, 2012 15:48
class2go
TIME_ZONE = 'Asia/Riyadh'
LANGUAGE_CODE = 'ar'
ugettext = lambda s: s
LANGUAGES = (
('ar', ugettext('Arabic')),
('en', ugettext('English')),
)
# What's this? It's a monster list of Google domain names that have been found to refer
# users to sites that are monitored with Shaun Inman's "Mint" statistics package. http:/haveamint.com/
#
# A huge number of these came from Shawn Blanc's domain list here:
# http://shawnblanc.net/2010/08/cleanup-mint-unique-referrers/
#
# I merged them in to my existing list for this "MONSTAH LIST". Enjoy!
#
# To filter many, many of the Google search results from your "Newest Unique Referrers" results in
# Mint, copy the list below verbatim (don't include these "comment" lines) and paste them into your