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
// backbone form editor (form field) | |
Backbone.Form.editors.SingleFileUpload = Backbone.Form.editors.Base.extend ({ | |
//tagName:"input", | |
_self: false, | |
uploader: false, | |
template:false, | |
template_id: "#singleFileUploadTemplate", | |
additional_fields: [], | |
events: { | |
'change': function() { |
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
import os | |
from filer.utils.files import get_valid_filename | |
def no_subfolders(instance, filename): | |
return get_valid_filename(filename) |
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 -*- | |
""" | |
Whoosh backend for haystack that implements character folding, as per | |
http://packages.python.org/Whoosh/stemming.html#character-folding . | |
Tested with Haystack 2.4.0 and Whooch 2.7.0 | |
To use, put this file on your path and add it to your haystack settings, eg. |
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.urlresolvers import reverse | |
from django.utils.translation import ugettext_lazy as _ | |
from cms.toolbar_pool import toolbar_pool | |
from cms.cms_toolbar import ADMIN_MENU_IDENTIFIER, LANGUAGE_MENU_IDENTIFIER | |
from cms.toolbar_base import CMSToolbar | |
from cms.toolbar.items import Break | |
@toolbar_pool.register |
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 .... | |
class LinkBase(models.Model): | |
link_text = models.CharField(verbose_name=_('Link Text'), max_length=255, | |
blank=True, default='') | |
link_type = models.CharField(verbose_name=_('Link'), max_length=20, choices=LINK_TYPE_CHOICES, | |
blank=True, default='') | |
page = PageField(null=True, blank=True) | |
file = FilerFileField(null=True, blank=True, related_name='link') | |
mailto = models.EmailField(null=True, blank=True) |
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 django.contrib import admin | |
from django import forms | |
from django.utils.translation import ugettext_lazy as _ | |
from cms.models import Page | |
from cms.admin.forms import PageForm | |
from cms.admin.pageadmin import PageAdmin | |
class CustomPageForm(PageForm): | |
page_title = forms.CharField(label=_("Title Tag"), widget=forms.TextInput(), |
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
document.addEventListener('touchstart', function addtouchclass(e){ // first time user touches the screen | |
document.documentElement.classList.add('is-touch') // add "can-touch" class to document root using classList API | |
document.removeEventListener('touchstart', addtouchclass, false) // de-register touchstart event | |
}, false) |
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
// check: if we came frome our own site, just use history.back() | |
// as simple as it gets. | |
on_back_click: function(e) { | |
// this check could be further enhanced, but works quite well already. | |
if (document.referrer.indexOf(window.location.host) !== -1) { | |
e.preventDefault(); | |
history.back(); | |
} | |
} |
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 fabric.api import task, env, run, local, roles, cd, execute, hide, puts,\ | |
sudo | |
import posixpath | |
import re | |
env.forward_agent = True | |
env.project_name = 'parkhotel' # var | |
env.repository = 'git@bitbucket.org:benzkji/bnzk_{project_name}.git'.format(**env) | |
env.local_branch = 'master' | |
env.remote_ref = 'origin/master' |
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 __future__ import unicode_literals | |
from aldryn_search.base import AldrynIndexBase | |
from django.template.loader import render_to_string | |
from haystack import indexes | |
from bodenschatz.models import Product | |
class ProductIndex(AldrynIndexBase, indexes.Indexable): |
OlderNewer