Skip to content

Instantly share code, notes, and snippets.

View chronossc's full-sized avatar

Felipe Prenholato chronossc

View GitHub Profile
@augustomen
augustomen / lookups.py
Last active December 11, 2015 02:39
WordModelLookup: a Django Selectable lookup that searches anywhere in the field
import operator
from django.db.models import Q
from selectable.base import LookupBase, ModelLookup
# if term is 'foo - bar', the middle '-' is ignored
SEARCH_IGNORED = (',', '.', '-', '/', ';', ':', '=', '\\',)
def split_terms(get_query):
""" This decorator breaks a single string received in the request by a
list of strings.
diff -ur django_original/template//debug.py django/template//debug.py
--- django_original/template//debug.py 2011-05-02 13:36:03.872849001 -0300
+++ django/template//debug.py 2011-05-05 14:17:20.522849008 -0300
@@ -87,6 +87,7 @@
def render(self, context):
try:
output = self.filter_expression.resolve(context)
+ output = self.clean_pks(output)
output = localize(output)
output = force_unicode(output)