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
function TableSort(oTableElement) { | |
this.tbl = oTableElement; | |
this.lastSortedTh = null; | |
if (this.tbl && this.tbl.nodeName == "TABLE") { | |
var headings = this.tbl.tHead.rows[0].cells; | |
for (var i=0; headings[i]; i++) { | |
if (headings[i].className.match(/asc|dsc/)) { | |
this.lastSortedTh = headings[i]; | |
} | |
} |
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
"use strict"; | |
/* | |
* JQuery Substitute method allows for simple templating using JS Object dot notation. | |
* Contribute link: https://gist.github.com/danielsokolowski/0954fc2a767f441720b9 | |
* | |
* @param strTemplate - string contain the replacement tokens | |
* @param objData - an Object represetnting your replacmenet values | |
* | |
* Example: | |
* var strTemplate = 'Hello {user.name}' |
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 import template, template | |
from django.contrib.auth.models import Group | |
from guardian.shortcuts import get_groups_with_perms | |
register = template.Library() | |
class ObjectGroups(template.Node): | |
""" | |
Returns an html string node useful for providing a visual cue to the | |
permission group required. | |
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
Unfortunately the built in Django JSON serialzer encodes GeoDjango GeometyrField as WKT text. This snippet extends django's serializer and adds support for GEOJson format. | |
Built in JSON serializer output: | |
[{"pk": 1, ... "geopoint": "POINT (-76.5060419999999937 44.2337040000000030)" ... }] | |
GeoJSON serializer ouput: | |
[{"pk": 1, ... "geopoint": {"type": "Point", | |
"coordinates": [-76.503296000000006, 44.230956999999997], | |
"__GEOSGeometry__": [ | |
"__init__", |
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 re | |
import hashlib | |
from django import template | |
register = template.Library() | |
class ToHexWebColorNode(template.Node): | |
def __init__(self, vartoconvert, varnametostoreas=False): | |
self.vartoconvert = template.Variable(vartoconvert) | |
self.varnametostoreas = varnametostoreas |
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
''' | |
Created on 2011-05-12 | |
@author: Daniel Sokolowski | |
Extends django's built in JSON serializer to support GEOJSON encoding | |
Requirements: | |
Install and setup geodjango (django.contrib.gis) |