david / scrumpy
Example project during scrumpy, a very very basic twitter. Clone, hack, get rich or die tryin'
| commit 0: | 5659f11176f1 |
| branch: | default |
8 months ago
Changed (Δ6.5 KB):
__init__.py (null-size change)
locale/fr/LC_MESSAGES/django.mo (binary file changed)
locale/fr/LC_MESSAGES/django.po (21 lines added, 0 lines removed)
manage.py (11 lines added, 0 lines removed)
messages/__init__.py (null-size change)
messages/admin.py (4 lines added, 0 lines removed)
messages/models.py (14 lines added, 0 lines removed)
messages/tests.py (23 lines added, 0 lines removed)
messages/urls.py (7 lines added, 0 lines removed)
messages/views.py (7 lines added, 0 lines removed)
settings.py (83 lines added, 0 lines removed)
templates/base.html (12 lines added, 0 lines removed)
templates/messages/twmessage_list.html (9 lines added, 0 lines removed)
urls.py (16 lines added, 0 lines removed)
Up to file-list locale/fr/LC_MESSAGES/django.mo:
Up to file-list locale/fr/LC_MESSAGES/django.po:
1 |
# SOME DESCRIPTIVE TITLE. |
|
2 |
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
|
3 |
# This file is distributed under the same license as the PACKAGE package. |
|
4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
|
5 |
# |
|
6 |
#, fuzzy |
|
7 |
msgid "" |
|
8 |
msgstr "" |
|
9 |
"Project-Id-Version: PACKAGE VERSION\n" |
|
10 |
"Report-Msgid-Bugs-To: \n" |
|
11 |
"POT-Creation-Date: 2009-10-23 10:02-0500\n" |
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n" |
|
15 |
"MIME-Version: 1.0\n" |
|
16 |
"Content-Type: text/plain; charset=UTF-8\n" |
|
17 |
"Content-Transfer-Encoding: 8bit\n" |
|
18 |
||
19 |
#: templates/messages/twmessage_list.html:6 |
|
20 |
msgid "said" |
|
21 |
msgstr "a dit" |
1 |
#!/usr/bin/env python |
|
2 |
from django.core.management import execute_manager |
|
3 |
try: |
|
4 |
import settings # Assumed to be in the same directory. |
|
5 |
except ImportError: |
|
6 |
import sys |
|
7 |
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) |
|
8 |
sys.exit(1) |
|
9 |
||
10 |
if __name__ == "__main__": |
|
11 |
execute_manager(settings) |
Up to file-list messages/admin.py:
1 |
from django.contrib import admin |
|
2 |
from models import TwMessage |
|
3 |
||
4 |
admin.site.register(TwMessage) |
Up to file-list messages/models.py:
1 |
from django.db import models |
|
2 |
from django.contrib.auth.models import User |
|
3 |
||
4 |
class TwMessage(models.Model): |
|
5 |
"""""" |
|
6 |
content = models.TextField() |
|
7 |
author = models.ForeignKey(User) |
|
8 |
in_reply_to = models.ForeignKey('self', blank=True, null=True) |
|
9 |
||
10 |
def __unicode__(self): |
|
11 |
return u"%s from %s" % (self.content, self.author) |
|
12 |
||
13 |
||
14 |
Up to file-list messages/tests.py:
1 |
""" |
|
2 |
This file demonstrates two different styles of tests (one doctest and one |
|
3 |
unittest). These will both pass when you run "manage.py test". |
|
4 |
||
5 |
Replace these with more appropriate tests for your application. |
|
6 |
""" |
|
7 |
||
8 |
from django.test import TestCase |
|
9 |
||
10 |
class SimpleTest(TestCase): |
|
11 |
def test_basic_addition(self): |
|
12 |
""" |
|
13 |
Tests that 1 + 1 always equals 2. |
|
14 |
""" |
|
15 |
self.failUnlessEqual(1 + 1, 2) |
|
16 |
||
17 |
__test__ = {"doctest": """ |
|
18 |
Another way to test that 1 + 1 is equal to 2. |
|
19 |
||
20 |
>>> 1 + 1 == 2 |
|
21 |
True |
|
22 |
"""} |
|
23 |
Up to file-list messages/urls.py:
1 |
from django.conf.urls.defaults import * |
|
2 |
||
3 |
from views import message_list |
|
4 |
||
5 |
urlpatterns = patterns('', |
|
6 |
(r'^$', message_list), |
|
7 |
) |
Up to file-list messages/views.py:
1 |
# Create your views here. |
|
2 |
||
3 |
from django.views.generic.list_detail import object_list |
|
4 |
from models import TwMessage |
|
5 |
||
6 |
def message_list(request): |
|
7 |
return object_list(request, TwMessage.objects.all()) |
1 |
# Django settings for twgroups project. |
|
2 |
||
3 |
DEBUG = True |
|
4 |
TEMPLATE_DEBUG = DEBUG |
|
5 |
||
6 |
ADMINS = ( |
|
7 |
# ('Your Name', 'your_email@domain.com'), |
|
8 |
) |
|
9 |
||
10 |
MANAGERS = ADMINS |
|
11 |
||
12 |
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. |
|
13 |
DATABASE_NAME = 'db.sqlite' # Or path to database file if using sqlite3. |
|
14 |
DATABASE_USER = '' # Not used with sqlite3. |
|
15 |
DATABASE_PASSWORD = '' # Not used with sqlite3. |
|
16 |
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. |
|
17 |
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. |
|
18 |
||
19 |
# Local time zone for this installation. Choices can be found here: |
|
20 |
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
|
21 |
# although not all choices may be available on all operating systems. |
|
22 |
# If running in a Windows environment this must be set to the same as your |
|
23 |
# system time zone. |
|
24 |
TIME_ZONE = 'America/Chicago' |
|
25 |
||
26 |
# Language code for this installation. All choices can be found here: |
|
27 |
# http://www.i18nguy.com/unicode/language-identifiers.html |
|
28 |
LANGUAGE_CODE = 'en-us' |
|
29 |
||
30 |
SITE_ID = 1 |
|
31 |
||
32 |
# If you set this to False, Django will make some optimizations so as not |
|
33 |
# to load the internationalization machinery. |
|
34 |
USE_I18N = True |
|
35 |
||
36 |
# Absolute path to the directory that holds media. |
|
37 |
# Example: "/home/media/media.lawrence.com/" |
|
38 |
MEDIA_ROOT = '' |
|
39 |
||
40 |
# URL that handles the media served from MEDIA_ROOT. Make sure to use a |
|
41 |
# trailing slash if there is a path component (optional in other cases). |
|
42 |
# Examples: "http://media.lawrence.com", "http://example.com/media/" |
|
43 |
MEDIA_URL = '' |
|
44 |
||
45 |
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a |
|
46 |
# trailing slash. |
|
47 |
# Examples: "http://foo.com/media/", "/media/". |
|
48 |
ADMIN_MEDIA_PREFIX = '/media/' |
|
49 |
||
50 |
# Make this unique, and don't share it with anybody. |
|
51 |
SECRET_KEY = '62@xf0!vym6*!!(ztfb5*&3)%84#2%*8z26t(*4^!yi&*09a-y' |
|
52 |
||
53 |
# List of callables that know how to import templates from various sources. |
|
54 |
TEMPLATE_LOADERS = ( |
|
55 |
'django.template.loaders.filesystem.load_template_source', |
|
56 |
'django.template.loaders.app_directories.load_template_source', |
|
57 |
# 'django.template.loaders.eggs.load_template_source', |
|
58 |
) |
|
59 |
||
60 |
MIDDLEWARE_CLASSES = ( |
|
61 |
'django.middleware.common.CommonMiddleware', |
|
62 |
'django.middleware.locale.LocaleMiddleware', |
|
63 |
'django.contrib.sessions.middleware.SessionMiddleware', |
|
64 |
'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
65 |
) |
|
66 |
||
67 |
ROOT_URLCONF = 'twgroups.urls' |
|
68 |
||
69 |
TEMPLATE_DIRS = ( |
|
70 |
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
|
71 |
# Always use forward slashes, even on Windows. |
|
72 |
# Don't forget to use absolute paths, not relative paths. |
|
73 |
'templates', |
|
74 |
) |
|
75 |
||
76 |
INSTALLED_APPS = ( |
|
77 |
'django.contrib.auth', |
|
78 |
'django.contrib.admin', |
|
79 |
'django.contrib.contenttypes', |
|
80 |
'django.contrib.sessions', |
|
81 |
'django.contrib.sites', |
|
82 |
'messages', |
|
83 |
) |
Up to file-list templates/base.html:
1 |
<!DOCTYPE html> |
|
2 |
<html> |
|
3 |
<head> |
|
4 |
<meta charset='utf-8'> |
|
5 |
<title>Titre</title> |
|
6 |
</head> |
|
7 |
<body> |
|
8 |
{% block content %} |
|
9 |
||
10 |
{% endblock content %} |
|
11 |
</body> |
|
12 |
</html> |
Up to file-list templates/messages/twmessage_list.html:
1 |
{% extends "base.html" %} |
|
2 |
{% load i18n %} |
|
3 |
{% block content %} |
|
4 |
<ul> |
|
5 |
{% for object in object_list %} |
|
6 |
<li>{{ object.author }} {% trans "said" %} {{ object.content }}</li> |
|
7 |
{% endfor %} |
|
8 |
</ul> |
|
9 |
{% endblock content %} |
1 |
from django.conf.urls.defaults import * |
|
2 |
||
3 |
# Uncomment the next two lines to enable the admin: |
|
4 |
from django.contrib import admin |
|
5 |
admin.autodiscover() |
|
6 |
||
7 |
urlpatterns = patterns('', |
|
8 |
(r'^messages/', include('messages.urls')), |
|
9 |
||
10 |
# Uncomment the admin/doc line below and add 'django.contrib.admindocs' |
|
11 |
# to INSTALLED_APPS to enable admin documentation: |
|
12 |
# (r'^admin/doc/', include('django.contrib.admindocs.urls')), |
|
13 |
||
14 |
# Uncomment the next line to enable the admin: |
|
15 |
(r'^admin/', include(admin.site.urls)), |
|
16 |
) |
