From b454a79d106d256f7eea8d0e23567e613928bab5 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Sat, 19 Mar 2011 22:15:12 +0200 Subject: and it worked --- demo/main/__init__.py | 0 demo/main/models.py | 3 +++ demo/main/tests.py | 23 +++++++++++++++++++++++ demo/main/views.py | 5 +++++ demo/urls.py | 2 +- 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 demo/main/__init__.py create mode 100644 demo/main/models.py create mode 100644 demo/main/tests.py create mode 100644 demo/main/views.py (limited to 'demo') diff --git a/demo/main/__init__.py b/demo/main/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/demo/main/models.py b/demo/main/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/demo/main/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/demo/main/tests.py b/demo/main/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/demo/main/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these 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.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/demo/main/views.py b/demo/main/views.py new file mode 100644 index 0000000..8e71fa8 --- /dev/null +++ b/demo/main/views.py @@ -0,0 +1,5 @@ +from django.shortcuts import render_to_response +from django.template import RequestContext + +def index(request): + return render_to_response('main.html', {}, context_instance=RequestContext(request)) \ No newline at end of file diff --git a/demo/urls.py b/demo/urls.py index 5b3c71e..29533a2 100644 --- a/demo/urls.py +++ b/demo/urls.py @@ -7,7 +7,7 @@ from django.template import Context, loader admin.autodiscover() urlpatterns = patterns('', - (r'^$', lambda r: HttpResponse(loader.get_template('main.html').render(Context({})))), + (r'^$', 'demo.main.views.index'), (r'^fb/', include('fb.urls')), (r'^admin/doc/', include('django.contrib.admindocs.urls')), -- cgit v1.3.1