summaryrefslogtreecommitdiff
path: root/docs/intro
diff options
context:
space:
mode:
authorGabriel Hurley <gabehr@gmail.com>2010-10-19 00:11:51 +0000
committerGabriel Hurley <gabehr@gmail.com>2010-10-19 00:11:51 +0000
commit9dfdcf86befecad3b638df03273719c5ada90a45 (patch)
tree9d4156d929684d3166f5dd4a951a321f36363d66 /docs/intro
parentefcb7776a0209447cc8ac3eb12760c197eeed7bb (diff)
[1.2.X] Fixed #14426 -- Removed "mysite" import statements from examples that might teach people "bad habits" in regards to creating reusable apps.
Thanks to idahogray for assisting with the patch (and sorry for forgetting the attribution in the patch on trunk). Backport of [14270] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14271 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/intro')
-rw-r--r--docs/intro/overview.txt14
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt
index 0c47e59e14..34572a6c80 100644
--- a/docs/intro/overview.txt
+++ b/docs/intro/overview.txt
@@ -21,7 +21,8 @@ code.
The :doc:`data-model syntax </topics/db/models>` offers many rich ways of
representing your models -- so far, it's been solving two years' worth of
-database-schema problems. Here's a quick example::
+database-schema problems. Here's a quick example, which might be saved in
+the file ``mysite/news/models.py``::
class Reporter(models.Model):
full_name = models.CharField(max_length=70)
@@ -57,7 +58,8 @@ Enjoy the free API
With that, you've got a free, and rich, :doc:`Python API </topics/db/queries>` to
access your data. The API is created on the fly, no code generation necessary::
- >>> from mysite.models import Reporter, Article
+ # Import the models we created from our "news" app
+ >>> from news.models import Reporter, Article
# No reporters are in the system yet.
>>> Reporter.objects.all()
@@ -177,9 +179,9 @@ example above::
from django.conf.urls.defaults import *
urlpatterns = patterns('',
- (r'^articles/(\d{4})/$', 'mysite.views.year_archive'),
- (r'^articles/(\d{4})/(\d{2})/$', 'mysite.views.month_archive'),
- (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'mysite.views.article_detail'),
+ (r'^articles/(\d{4})/$', 'news.views.year_archive'),
+ (r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),
+ (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
)
The code above maps URLs, as simple regular expressions, to the location of
@@ -195,7 +197,7 @@ is a simple Python function. Each view gets passed a request object --
which contains request metadata -- and the values captured in the regex.
For example, if a user requested the URL "/articles/2005/05/39323/", Django
-would call the function ``mysite.views.article_detail(request,
+would call the function ``news.views.article_detail(request,
'2005', '05', '39323')``.
Write your views