Code

Ticket #14426: remove_mysite_from_import.3.diff

File remove_mysite_from_import.3.diff, 10.5 KB (added by idahogray, 4 years ago)
Line 
1Index: docs/intro/overview.txt
2===================================================================
3--- docs/intro/overview.txt     (revision 14240)
4+++ docs/intro/overview.txt     (working copy)
5@@ -21,7 +21,8 @@
6 
7 The :doc:`data-model syntax </topics/db/models>` offers many rich ways of
8 representing your models -- so far, it's been solving two years' worth of
9-database-schema problems. Here's a quick example::
10+database-schema problems. Here's a quick example, which might be saved in
11+the file ``mysite/news/models.py``::
12 
13     class Reporter(models.Model):
14         full_name = models.CharField(max_length=70)
15@@ -57,7 +58,8 @@
16 With that, you've got a free, and rich, :doc:`Python API </topics/db/queries>` to
17 access your data. The API is created on the fly, no code generation necessary::
18 
19-    >>> from mysite.models import Reporter, Article
20+    # Import the models we created from our "news" app
21+    >>> from news.models import Reporter, Article
22 
23     # No reporters are in the system yet.
24     >>> Reporter.objects.all()
25@@ -177,9 +179,9 @@
26     from django.conf.urls.defaults import *
27 
28     urlpatterns = patterns('',
29-        (r'^articles/(\d{4})/$', 'mysite.views.year_archive'),
30-        (r'^articles/(\d{4})/(\d{2})/$', 'mysite.views.month_archive'),
31-        (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'mysite.views.article_detail'),
32+        (r'^articles/(\d{4})/$', 'news.views.year_archive'),
33+        (r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),
34+        (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
35     )
36 
37 The code above maps URLs, as simple regular expressions, to the location of
38@@ -195,7 +197,7 @@
39 which contains request metadata -- and the values captured in the regex.
40 
41 For example, if a user requested the URL "/articles/2005/05/39323/", Django
42-would call the function ``mysite.views.article_detail(request,
43+would call the function ``news.views.article_detail(request,
44 '2005', '05', '39323')``.
45 
46 Write your views
47Index: docs/topics/http/urls.txt
48===================================================================
49--- docs/topics/http/urls.txt   (revision 14240)
50+++ docs/topics/http/urls.txt   (working copy)
51@@ -338,12 +338,12 @@
52     from django.conf.urls.defaults import *
53 
54     urlpatterns = patterns('',
55-        (r'^articles/(\d{4})/$', 'mysite.news.views.year_archive'),
56-        (r'^articles/(\d{4})/(\d{2})/$', 'mysite.news.views.month_archive'),
57-        (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'mysite.news.views.article_detail'),
58+        (r'^articles/(\d{4})/$', 'news.views.year_archive'),
59+        (r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),
60+        (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
61     )
62 
63-In this example, each view has a common prefix -- ``'mysite.news.views'``.
64+In this example, each view has a common prefix -- ``'news.views'``.
65 Instead of typing that out for each entry in ``urlpatterns``, you can use the
66 first argument to the ``patterns()`` function to specify a prefix to apply to
67 each view function.
68@@ -352,7 +352,7 @@
69 
70     from django.conf.urls.defaults import *
71 
72-    urlpatterns = patterns('mysite.news.views',
73+    urlpatterns = patterns('news.views',
74         (r'^articles/(\d{4})/$', 'year_archive'),
75         (r'^articles/(\d{4})/(\d{2})/$', 'month_archive'),
76         (r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'article_detail'),
77@@ -564,8 +564,8 @@
78 
79     # inner.py
80     urlpatterns = patterns('',
81-        (r'^archive/$', 'mysite.views.archive'),
82-        (r'^about/$', 'mysite.views.about'),
83+        (r'^archive/$', 'views.archive'),
84+        (r'^about/$', 'views.about'),
85     )
86 
87 Set two::
88@@ -577,8 +577,8 @@
89 
90     # inner.py
91     urlpatterns = patterns('',
92-        (r'^archive/$', 'mysite.views.archive', {'blogid': 3}),
93-        (r'^about/$', 'mysite.views.about', {'blogid': 3}),
94+        (r'^archive/$', 'views.archive', {'blogid': 3}),
95+        (r'^about/$', 'views.about', {'blogid': 3}),
96     )
97 
98 Note that extra options will *always* be passed to *every* line in the included
99@@ -596,15 +596,15 @@
100 For example, given this URLconf in "string" notation::
101 
102     urlpatterns = patterns('',
103-        (r'^archive/$', 'mysite.views.archive'),
104-        (r'^about/$', 'mysite.views.about'),
105-        (r'^contact/$', 'mysite.views.contact'),
106+        (r'^archive/$', 'views.archive'),
107+        (r'^about/$', 'views.about'),
108+        (r'^contact/$', 'views.contact'),
109     )
110 
111 You can accomplish the same thing by passing objects rather than strings. Just
112 be sure to import the objects::
113 
114-    from mysite.views import archive, about, contact
115+    from views import archive, about, contact
116 
117     urlpatterns = patterns('',
118         (r'^archive/$', archive),
119Index: docs/topics/http/views.txt
120===================================================================
121--- docs/topics/http/views.txt  (revision 14240)
122+++ docs/topics/http/views.txt  (working copy)
123@@ -138,7 +138,7 @@
124 you want to override the 404 view, you can specify ``handler404`` in your
125 URLconf, like so::
126 
127-    handler404 = 'mysite.views.my_custom_404_view'
128+    handler404 = 'views.my_custom_404_view'
129 
130 Behind the scenes, Django determines the 404 view by looking for ``handler404``.
131 By default, URLconfs contain the following line::
132@@ -186,7 +186,7 @@
133 you want to override the view, you can specify ``handler500`` in your
134 URLconf, like so::
135 
136-    handler500 = 'mysite.views.my_custom_error_view'
137+    handler500 = 'views.my_custom_error_view'
138 
139 Behind the scenes, Django determines the error view by looking for ``handler500``.
140 By default, URLconfs contain the following line::
141Index: docs/topics/db/models.txt
142===================================================================
143--- docs/topics/db/models.txt   (revision 14240)
144+++ docs/topics/db/models.txt   (working copy)
145@@ -79,7 +79,7 @@
146 
147     INSTALLED_APPS = (
148         #...
149-        'mysite.myapp',
150+        'myapp',
151         #...
152     )
153 
154@@ -570,7 +570,7 @@
155 import the related model at the top of the model that holds your model. Then,
156 just refer to the other model class wherever needed. For example::
157 
158-    from mysite.geography.models import ZipCode
159+    from geography.models import ZipCode
160 
161     class Restaurant(models.Model):
162         # ...
163Index: docs/topics/db/queries.txt
164===================================================================
165--- docs/topics/db/queries.txt  (revision 14240)
166+++ docs/topics/db/queries.txt  (working copy)
167@@ -60,7 +60,7 @@
168 
169 Assuming models live in a file ``mysite/blog/models.py``, here's an example::
170 
171-    >>> from mysite.blog.models import Blog
172+    >>> from blog.models import Blog
173     >>> b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
174     >>> b.save()
175 
176@@ -98,7 +98,7 @@
177 field; simply assign an object of the right type to the field in question.
178 This example updates the ``blog`` attribute of an ``Entry`` instance ``entry``::
179 
180-    >>> from mysite.blog.models import Entry
181+    >>> from blog.models import Entry
182     >>> entry = Entry.objects.get(pk=1)
183     >>> cheese_blog = Blog.objects.get(name="Cheddar Talk")
184     >>> entry.blog = cheese_blog
185@@ -108,7 +108,7 @@
186 method on the field to add a record to the relation. This example adds the
187 ``Author`` instance ``joe`` to the ``entry`` object::
188 
189-    >>> from mysite.blog.models import Author
190+    >>> from blog.models import Author
191     >>> joe = Author.objects.create(name="Joe")
192     >>> entry.authors.add(joe)
193 
194Index: docs/topics/generic-views.txt
195===================================================================
196--- docs/topics/generic-views.txt       (revision 14240)
197+++ docs/topics/generic-views.txt       (working copy)
198@@ -72,7 +72,7 @@
199 
200     from django.conf.urls.defaults import *
201     from django.views.generic.simple import direct_to_template
202-    **from mysite.books.views import about_pages**
203+    **from books.views import about_pages**
204 
205     urlpatterns = patterns('',
206         ('^about/$', direct_to_template, {
207@@ -152,7 +152,7 @@
208 
209     from django.conf.urls.defaults import *
210     from django.views.generic import list_detail
211-    from mysite.books.models import Publisher
212+    from books.models import Publisher
213 
214     publisher_info = {
215         "queryset" : Publisher.objects.all(),
216@@ -251,7 +251,7 @@
217 
218 .. parsed-literal::
219 
220-    from mysite.books.models import Publisher, **Book**
221+    from books.models import Publisher, **Book**
222 
223     publisher_info = {
224         "queryset" : Publisher.objects.all(),
225@@ -376,7 +376,7 @@
226 
227 .. parsed-literal::
228 
229-    from mysite.books.views import books_by_publisher
230+    from books.views import books_by_publisher
231 
232     urlpatterns = patterns('',
233         (r'^publishers/$', list_detail.object_list, publisher_info),
234@@ -387,7 +387,7 @@
235 
236     from django.http import Http404
237     from django.views.generic import list_detail
238-    from mysite.books.models import Book, Publisher
239+    from books.models import Book, Publisher
240 
241     def books_by_publisher(request, name):
242 
243@@ -447,7 +447,7 @@
244 
245 .. parsed-literal::
246 
247-    from mysite.books.views import author_detail
248+    from books.views import author_detail
249 
250     urlpatterns = patterns('',
251         #...
252@@ -457,7 +457,7 @@
253 Then we'd write our wrapper function::
254 
255     import datetime
256-    from mysite.books.models import Author
257+    from books.models import Author
258     from django.views.generic import list_detail
259     from django.shortcuts import get_object_or_404
260 
261Index: docs/ref/contrib/formtools/form-wizard.txt
262===================================================================
263--- docs/ref/contrib/formtools/form-wizard.txt  (revision 14240)
264+++ docs/ref/contrib/formtools/form-wizard.txt  (working copy)
265@@ -193,7 +193,7 @@
266 arguments when you instantiate the Wizard::
267 
268     from django.conf.urls.defaults import *
269-    from mysite.testapp.forms import ContactForm1, ContactForm2, ContactWizard
270+    from testapp.forms import ContactForm1, ContactForm2, ContactWizard
271 
272     urlpatterns = patterns('',
273         (r'^contact/$', ContactWizard([ContactForm1, ContactForm2])),
274Index: docs/ref/contrib/sitemaps.txt
275===================================================================
276--- docs/ref/contrib/sitemaps.txt       (revision 14240)
277+++ docs/ref/contrib/sitemaps.txt       (working copy)
278@@ -95,7 +95,7 @@
279 your sitemap class might look::
280 
281     from django.contrib.sitemaps import Sitemap
282-    from mysite.blog.models import Entry
283+    from blog.models import Entry
284 
285     class BlogSitemap(Sitemap):
286         changefreq = "never"
287@@ -242,7 +242,7 @@
288 
289     from django.conf.urls.defaults import *
290     from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
291-    from mysite.blog.models import Entry
292+    from blog.models import Entry
293 
294     info_dict = {
295         'queryset': Entry.objects.all(),