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 Base(models.Model): | |
created = models.DateTimeField(_(u'Created'), editable=False) | |
modified = models.DateTimeField(_(u'Modified'), editable=False) | |
class Meta: | |
abstract = 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.core.exceptions import ValidationError | |
import time | |
import re | |
def validate_year(value): | |
""" | |
Validator function for model.IntegerField() | |
* Validates a valid four-digit year. | |
* Must be a current or future year. |
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 urllib, urllib2, simplejson | |
from django.utils.encoding import smart_str | |
def get_lat_lng(location): | |
# http://djangosnippets.org/snippets/293/ | |
# http://code.google.com/p/gmaps-samples/source/browse/trunk/geocoder/python/SimpleParser.py?r=2476 | |
# http://stackoverflow.com/questions/2846321/best-and-simple-way-to-handle-json-in-django | |
# http://djangosnippets.org/snippets/2399/ | |
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 Category(Base): | |
slug = models.SlugField(_(u'slug'), max_length=100, unique=True) | |
title = models.CharField(_(u'title'), max_length=250) | |
parent = models.ForeignKey('self', blank=True, null=True, related_name='child') | |
class Meta: | |
verbose_name_plural = 'Categories' |
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
# ... | |
###################################### | |
## | |
## Abstract models: | |
## | |
###################################### | |
class Base(models.Model): | |
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
/* | |
** | |
** CSS: text-overflow | |
** URI: http://www.quirksmode.org/css/textoverflow.html | |
** | |
** JS: jquery.textOverflow | |
** Website: http://www.bramstein.com/projects/text-overflow/ | |
** About: This jQuery plugin implements a simplified version of the CSS3 text-overflow property [for Firefox]. | |
** Compatibility: | |
** Mac: Firefox v3.6, Safari v4.0.3 (5531.9), Opera v10.10, Chrome v4.0.249.49 (35163) beta |
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
.test { | |
background: #000; | |
background: -moz-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%); | |
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #000), color-stop(2%, #000), color-stop(2%, #5f5f5f), color-stop(3%, #5f5f5f), color-stop(3%, #1a1a1a), color-stop(4%, #1a1a1a), color-stop(4%, #333), color-stop(100%, #333)); | |
background: -webkit-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%); | |
background: -o-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%); | |
background: -ms-linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, #333 4px, #333 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#333333', GradientType=0); | |
background: linear-gradient(top, #000 0, #000 2px, #5f5f5f 2px, #5f5f5f 3px, #1a1a1a 3px, #1a1a1a 4px, |
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
<?php | |
function is_ajax() { | |
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') ? TRUE : 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
/* | |
** | |
** Notice: Links must follow this order: | |
** | |
** a (a:link) | |
** a:visited | |
** a:visited:hover | |
** a:focus | |
** a:focus:hover | |
** a:hover |
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
<csp:include page="/csp/cms/sites/web/demos/test1.inc.csp?var=foo"> | |
#($get(%request.Data("var", 1)))# | |
...... | |
Output is: | |
foo foo |