Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #12863 - bug in 'examples' app.

Fixed by removing the whole examples directory, since it provides poor
example code and poor documentation, both being catered for much better
elsewhere.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@12438 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 33a225cd89553c9d379f7f5ee85fb37353541949 1 parent 75d4e93
@spookylukey spookylukey authored
View
0  examples/__init__.py
No changes.
View
0  examples/hello/__init__.py
No changes.
View
10 examples/hello/urls.py
@@ -1,10 +0,0 @@
-from django.conf.urls.defaults import *
-
-urlpatterns = patterns('examples.hello.views',
- (r'^html/$', 'hello_html'),
- (r'^text/$', 'hello_text'),
- (r'^write/$', 'hello_write'),
- (r'^metadata/$', 'metadata'),
- (r'^getdata/$', 'get_data'),
- (r'^postdata/$', 'post_data'),
-)
View
55 examples/hello/views.py
@@ -1,55 +0,0 @@
-from django.http import HttpResponse
-from django.utils.html import escape
-
-def hello_html(request):
- "This view is a basic 'hello world' example in HTML."
- return HttpResponse('<h1>Hello, world.</h1>')
-
-def hello_text(request):
- "This view is a basic 'hello world' example in plain text."
- return HttpResponse('Hello, world.', mimetype='text/plain')
-
-def hello_write(request):
- "This view demonstrates how an HttpResponse object has a write() method."
- r = HttpResponse()
- r.write("<p>Here's a paragraph.</p>")
- r.write("<p>Here's another paragraph.</p>")
- return r
-
-def metadata(request):
- "This view demonstrates how to retrieve request metadata, such as HTTP headers."
- r = HttpResponse('<h1>All about you</h1>')
- r.write("<p>Here's all known metadata about your request, according to <code>request.META</code>:</p>")
- r.write('<table>')
- meta_items = request.META.items()
- meta_items.sort()
- for k, v in meta_items:
- r.write('<tr><th>%s</th><td>%r</td></tr>' % (k, v))
- r.write('</table>')
- return r
-
-def get_data(request):
- "This view demonstrates how to retrieve GET data."
- r = HttpResponse()
- if request.GET:
- r.write('<p>GET data found! Here it is:</p>')
- r.write('<ul>%s</ul>' % ''.join(['<li><strong>%s:</strong> %r</li>' % (escape(k), escape(v)) for k, v in request.GET.items()]))
- r.write('<form action="" method="get">')
- r.write('<p>First name: <input type="text" name="first_name"></p>')
- r.write('<p>Last name: <input type="text" name="last_name"></p>')
- r.write('<p><input type="submit" value="Submit"></p>')
- r.write('</form>')
- return r
-
-def post_data(request):
- "This view demonstrates how to retrieve POST data."
- r = HttpResponse()
- if request.POST:
- r.write('<p>POST data found! Here it is:</p>')
- r.write('<ul>%s</ul>' % ''.join(['<li><strong>%s:</strong> %r</li>' % (escape(k), escape(v)) for k, v in request.POST.items()]))
- r.write('<form action="" method="post">')
- r.write('<p>First name: <input type="text" name="first_name"></p>')
- r.write('<p>Last name: <input type="text" name="last_name"></p>')
- r.write('<p><input type="submit" value="Submit"></p>')
- r.write('</form>')
- return r
View
11 examples/manage.py
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-from django.core.management import execute_manager
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import sys
- 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" % __file__)
- sys.exit(1)
-
-if __name__ == "__main__":
- execute_manager(settings)
View
5 examples/settings.py
@@ -1,5 +0,0 @@
-# Django settings for the example project.
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-ROOT_URLCONF = 'examples.urls'
View
6 examples/urls.py
@@ -1,6 +0,0 @@
-from django.conf.urls.defaults import *
-
-urlpatterns = patterns('',
- (r'^$', 'examples.views.index'),
- (r'^hello/', include('examples.hello.urls')),
-)
View
12 examples/views.py
@@ -1,12 +0,0 @@
-from django import http
-
-def index(request):
- r = http.HttpResponse('<h1>Django examples</h1><ul>')
- r.write('<li><a href="hello/html/">Hello world (HTML)</a></li>')
- r.write('<li><a href="hello/text/">Hello world (text)</a></li>')
- r.write('<li><a href="hello/write/">HttpResponse objects are file-like objects</a></li>')
- r.write('<li><a href="hello/metadata/">Displaying request metadata</a></li>')
- r.write('<li><a href="hello/getdata/">Displaying GET data</a></li>')
- r.write('<li><a href="hello/postdata/">Displaying POST data</a></li>')
- r.write('</ul>')
- return r
Please sign in to comment.
Something went wrong with that request. Please try again.