<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# Standard 1.4 urls | |
{% url path.to.some_view v1 v2 %} | |
{% url path.to.some_view arg1=v1 arg2=v2 %} | |
{% url app_views.client client.id %} | |
{% url path.to.view arg arg2 as the_url %} | |
{% url path.to.view as the_url %} | |
# Namespaced 1.4 urls | |
{% url myapp:view-name %} | |
{% url myapp:path.to.some_view v1 v2 %} |
if (document.body.requestFullscreen || | |
document.body.mozRequestFullScreen || | |
document.body.webkitRequestFullscreen | |
) { | |
$("<button>View this chart in Full Screen</button>") | |
.on('click', function (e) { | |
var root = $interactive.get(0); | |
if (root.requestFullscreen) { root.requestFullscreen(); } | |
else if (root.mozRequestFullScreen) { root.mozRequestFullScreen(); } | |
else if (root.webkitRequestFullscreen) { root.webkitRequestFullscreen(); } |
class PubSub(object): | |
""" | |
Very simple Pub/Sub pattern wrapper | |
using simplified Redis Pub/Sub functionality. | |
Usage (publisher):: | |
import redis | |
r = redis.Redis() |
class FooAdmin(admin.ModelAdmin): | |
def get_urls(self): | |
urls = super(ContentProjectAdmin, self).get_urls() | |
extra_urls = patterns('', | |
url(r'^dashboard/$', self.admin_site.admin_view(self.dashboard), name="cms_dashboard"), | |
) | |
return extra_urls + urls | |
@property | |
def request(self): | |
""" | |
just for convenience | |
""" | |
return self |
STATUS_CANCELLED = 'cancelled' | |
STATUS_NEW = 'new' | |
STATUS_PENDING = 'pending' | |
STATUS_PAYMENT_DUE = 'payment-due' | |
STATUS_PAYMENT_PENDING = 'payment-pending' | |
STATUS_PAID = 'paid' | |
NEGOTIABLE_STATUS_CHOICES = ( | |
(STATUS_CANCELLED, 'Cancelled'), # Cancelled, duh | |
(STATUS_NEW, 'New'), # Default state of request |
from functools import wraps | |
from django.conf import settings | |
from django.http import HttpResponseRedirect | |
def require_ssl(view): | |
""" | |
Decorator that requires an SSL connection. If the current connection is not SSL, we redirect to the SSL version of | |
the page. |
Follow the instructions here: