Skip to content

Instantly share code, notes, and snippets.

# Python client for Dobby's Dudley (HTTP-receiver) protocol.
# Basically, what dobby uses to receive updates from HTTP.
try:
import simplejson as json
except:
import json
import urllib2
HOST = "localhost"
PORT = 8004
usernameField: SC.TextFieldView.design({
layout: { left: 155, top: 5, height: 20, width: 105 },
valueBinding: "UserIdent#signupController.username",
commitEditing: function() {
sc_super();
exports.signupController.validate("username");
return true;
}
}),
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
exampleView: SC.ListItemView.design({
renderLabel: function(context, label) {
if (label === undefined || label === 'undefined') label = "Loading...";
this._cachedLabel = label;
return arguments.callee.base.call(this, context, label);
},
mouseDown: function(evt){
sc_super();
var dv = SC.LabelView.create({
layout: {
from django.db import models
# Create your models here.
class Task(models.Model):
"""Our Task Model"""
description = models.TextField(blank=True)
is_done = models.BooleanField(default=False)
order = models.IntegerField(default=0)
def __unicode__(self):
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'todos', # ADD THIS LINE
)
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'todos.db'
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Note used.
DATABASE_PORT = '' # Not used.
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# You don't have to do it this way, but in this example, we match
# optional ending slashes.
(r'^tasks/?', "todos.views.tasks"),
(r'^task/(?P<taskid>[0-9]+)', "todos.view.task")
)
# We will need JSON support
try: import simplejson as json # If simplejson is installed, use that
except ImportError: import json # otherwise, in Python 2.6+, use built-in
# Import our model
from models import Task
# Response Mechanisms
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
# We will need JSON support
try: import simplejson as json # If simplejson is installed, use that
except ImportError: import json # otherwise, in Python 2.6+, use built-in
# Import our model
from models import Task
# Response Mechanisms
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse