Permalink
Browse files

Merge branch 'skdy-django'

  • Loading branch information...
2 parents 6cf776e + c42dc58 commit 1ee67f0068a51ed505b0f3579f113a0d9697bb51 @whiteinge committed Jan 14, 2012
@@ -0,0 +1,2 @@
+Django==1.3.1
+docutils==0.8.1
@@ -0,0 +1,9 @@
+from django.contrib import admin
+from myproject.myapp.models import TodoItem
+
+class TodoItemAdmin(admin.ModelAdmin):
+ list_display = ('pk', 'user', 'todo')
+ list_filter = ('timestamp',)
+ list_editable = ('todo',)
+
+admin.site.register(TodoItem, TodoItemAdmin)
@@ -0,0 +1,6 @@
+from django import forms
+from myproject.myapp.models import TodoItem
+
+class TodoItemForm(forms.ModelForm):
+ class Meta:
+ model = TodoItem
@@ -0,0 +1,11 @@
+from django.db import models
+
+class TodoItem(models.Model):
+ """This object store todos for an individual user
+
+ """
+ user = models.ForeignKey('auth.User')
+ todo = models.CharField(max_length=150)
+ timestamp = models.DateTimeField(
+ auto_now_add=True)
+
@@ -0,0 +1,16 @@
+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.assertEqual(1 + 1, 2)
@@ -0,0 +1,7 @@
+from django.conf.urls.defaults import \
+ include, patterns, url
+from myproject.myapp.views import MyTodos
+
+urlpatterns = patterns('',
+ url(r'^$', MyTodos.as_view(), name='todos'),
+)
@@ -0,0 +1,19 @@
+from django.views.generic.base import \
+ TemplateView
+from myproject.myapp.models import TodoItem
+
+class MyTodos(TemplateView):
+ """This is a test view
+
+ Objects available to the template:
+
+ todos
+ A list of :model:`myapp.TodoItem` objects.
+
+ """
+ template_name = 'my_todos.html'
+
+ def get(self, request, **kwargs):
+ context = {
+ 'todos': TodoItem.objects.all()}
+ return self.render_to_response(context)
@@ -0,0 +1,82 @@
+DEBUG = False
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = ()
+MANAGERS = ADMINS
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': 'devel.sqlite',
+ }
+}
+
+SECRET_KEY = '&v18gg^(zejox)in0f#jq3x&6%oo9@%7&ux_iv7#eh)ly2l6^_'
+
+SITE_ID = 1
+ROOT_URLCONF = 'myproject.urls'
+
+TIME_ZONE = 'America/Denver'
+LANGUAGE_CODE = 'en-us'
+USE_I18N = True
+USE_L10N = True
+
+MEDIA_ROOT = ''
+MEDIA_URL = ''
+STATIC_ROOT = ''
+STATIC_URL = '/static/'
+ADMIN_MEDIA_PREFIX = '/static/admin/'
+
+STATICFILES_DIRS = (
+)
+
+STATICFILES_FINDERS = (
+ 'django.contrib.staticfiles.finders.FileSystemFinder',
+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+)
+
+TEMPLATE_LOADERS = (
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+)
+
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+)
+
+TEMPLATE_DIRS = (
+)
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'django.contrib.admin',
+ 'django.contrib.admindocs',
+ 'myproject.myapp',
+)
+
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,
+ 'handlers': {
+ 'mail_admins': {
+ 'level': 'ERROR',
+ 'class': 'django.utils.log.AdminEmailHandler'
+ }
+ },
+ 'loggers': {
+ 'django.request': {
+ 'handlers': ['mail_admins'],
+ 'level': 'ERROR',
+ 'propagate': True,
+ },
+ }
+}
@@ -0,0 +1,23 @@
+import os.path
+
+from myproject.settings import *
+
+def FP(*path):
+ parent = os.path.join(os.path.dirname(__file__), os.path.pardir)
+ return os.path.abspath(os.path.join(parent, *path))
+
+DEBUG = True
+INTERNAL_IPS = '127.0.0.1'
+
+DATABASES['default'] = {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': FP('devel.sqlite'),
+}
+
+MIDDLEWARE_CLASSES += (
+ 'django.middleware.doc.XViewMiddleware',
+)
+
+TEMPLATE_DIRS += (
+ FP('templates'),
+)
@@ -0,0 +1,7 @@
+<!doctype html>
+<html lang="en">
+ <head><title>Hello, Django</title></head>
+ <body>
+ {% block main %}{% endblock %}
+ </body>
+</html>
@@ -0,0 +1,9 @@
+{% extends "base.html" %}
+
+{% block main %}
+ <ul>
+ {% for t in todos %}
+ <li>{{ t.todo }}</li>
+ {% endfor %}
+ </ul>
+{% endblock %}
@@ -0,0 +1,12 @@
+from django.conf.urls.defaults import patterns, include, url
+
+from django.contrib import admin
+admin.autodiscover()
+
+urlpatterns = patterns('',
+ (r'^todos/', include('myproject.myapp.urls',
+ namespace='todos')),
+
+ url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+ url(r'^admin/', include(admin.site.urls)),
+)
Oops, something went wrong.

0 comments on commit 1ee67f0

Please sign in to comment.