summaryrefslogtreecommitdiff
path: root/docs/topics
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/topics
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/topics')
-rw-r--r--docs/topics/db/models.txt2
-rw-r--r--docs/topics/db/queries.txt6
-rw-r--r--docs/topics/generic-views.txt14
-rw-r--r--docs/topics/http/urls.txt10
4 files changed, 16 insertions, 16 deletions
diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
index 0ff34ea0e1..2287053553 100644
--- a/docs/topics/db/models.txt
+++ b/docs/topics/db/models.txt
@@ -570,7 +570,7 @@ It's perfectly OK to relate a model to one from another app. To do this,
import the related model at the top of the model that holds your model. Then,
just refer to the other model class wherever needed. For example::
- from mysite.geography.models import ZipCode
+ from geography.models import ZipCode
class Restaurant(models.Model):
# ...
diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt
index e8966807b1..0ee417d86c 100644
--- a/docs/topics/db/queries.txt
+++ b/docs/topics/db/queries.txt
@@ -60,7 +60,7 @@ funky model importing.)
Assuming models live in a file ``mysite/blog/models.py``, here's an example::
- >>> from mysite.blog.models import Blog
+ >>> from blog.models import Blog
>>> b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
>>> b.save()
@@ -98,7 +98,7 @@ Updating a ``ForeignKey`` field works exactly the same way as saving a normal
field; simply assign an object of the right type to the field in question.
This example updates the ``blog`` attribute of an ``Entry`` instance ``entry``::
- >>> from mysite.blog.models import Entry
+ >>> from blog.models import Entry
>>> entry = Entry.objects.get(pk=1)
>>> cheese_blog = Blog.objects.get(name="Cheddar Talk")
>>> entry.blog = cheese_blog
@@ -108,7 +108,7 @@ Updating a ``ManyToManyField`` works a little differently; use the ``add()``
method on the field to add a record to the relation. This example adds the
``Author`` instance ``joe`` to the ``entry`` object::
- >>> from mysite.blog.models import Author
+ >>> from blog.models import Author
>>> joe = Author.objects.create(name="Joe")
>>> entry.authors.add(joe)
diff --git a/docs/topics/generic-views.txt b/docs/topics/generic-views.txt
index f90745d451..41e32c87aa 100644
--- a/docs/topics/generic-views.txt
+++ b/docs/topics/generic-views.txt
@@ -72,7 +72,7 @@ the URLconf to point to a view function:
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
- **from mysite.books.views import about_pages**
+ **from books.views import about_pages**
urlpatterns = patterns('',
('^about/$', direct_to_template, {
@@ -152,7 +152,7 @@ To build a list page of all publishers, we'd use a URLconf along these lines::
from django.conf.urls.defaults import *
from django.views.generic import list_detail
- from mysite.books.models import Publisher
+ from books.models import Publisher
publisher_info = {
"queryset" : Publisher.objects.all(),
@@ -251,7 +251,7 @@ detail view, we'd use an info dict like this:
.. parsed-literal::
- from mysite.books.models import Publisher, **Book**
+ from books.models import Publisher, **Book**
publisher_info = {
"queryset" : Publisher.objects.all(),
@@ -376,7 +376,7 @@ of code by hand. As usual, we'll start by writing a URLconf:
.. parsed-literal::
- from mysite.books.views import books_by_publisher
+ from books.views import books_by_publisher
urlpatterns = patterns('',
(r'^publishers/$', list_detail.object_list, publisher_info),
@@ -387,7 +387,7 @@ Next, we'll write the ``books_by_publisher`` view itself::
from django.http import Http404
from django.views.generic import list_detail
- from mysite.books.models import Book, Publisher
+ from books.models import Book, Publisher
def books_by_publisher(request, name):
@@ -447,7 +447,7 @@ custom view:
.. parsed-literal::
- from mysite.books.views import author_detail
+ from books.views import author_detail
urlpatterns = patterns('',
#...
@@ -457,7 +457,7 @@ custom view:
Then we'd write our wrapper function::
import datetime
- from mysite.books.models import Author
+ from books.models import Author
from django.views.generic import list_detail
from django.shortcuts import get_object_or_404
diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt
index 1a152ade5d..d176bbafae 100644
--- a/docs/topics/http/urls.txt
+++ b/docs/topics/http/urls.txt
@@ -338,12 +338,12 @@ Here's the example URLconf from the :doc:`Django overview </intro/overview>`::
from django.conf.urls.defaults import *
urlpatterns = patterns('',
- (r'^articles/(\d{4})/$', 'mysite.news.views.year_archive'),
- (r'^articles/(\d{4})/(\d{2})/$', 'mysite.news.views.month_archive'),
- (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'mysite.news.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'),
)
-In this example, each view has a common prefix -- ``'mysite.news.views'``.
+In this example, each view has a common prefix -- ``'news.views'``.
Instead of typing that out for each entry in ``urlpatterns``, you can use the
first argument to the ``patterns()`` function to specify a prefix to apply to
each view function.
@@ -352,7 +352,7 @@ With this in mind, the above example can be written more concisely as::
from django.conf.urls.defaults import *
- urlpatterns = patterns('mysite.news.views',
+ urlpatterns = patterns('news.views',
(r'^articles/(\d{4})/$', 'year_archive'),
(r'^articles/(\d{4})/(\d{2})/$', 'month_archive'),
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'article_detail'),