Ticket #14426: remove_mysite_from_import.diff
File remove_mysite_from_import.diff, 4.2 KB (added by , 14 years ago) |
---|
-
docs/topics/db/models.txt
570 570 import the related model at the top of the model that holds your model. Then, 571 571 just refer to the other model class wherever needed. For example:: 572 572 573 from mysite.geography.models import ZipCode573 from geography.models import ZipCode 574 574 575 575 class Restaurant(models.Model): 576 576 # ... -
docs/topics/db/queries.txt
60 60 61 61 Assuming models live in a file ``mysite/blog/models.py``, here's an example:: 62 62 63 >>> from mysite.blog.models import Blog63 >>> from blog.models import Blog 64 64 >>> b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.') 65 65 >>> b.save() 66 66 … … 98 98 field; simply assign an object of the right type to the field in question. 99 99 This example updates the ``blog`` attribute of an ``Entry`` instance ``entry``:: 100 100 101 >>> from mysite.blog.models import Entry101 >>> from blog.models import Entry 102 102 >>> entry = Entry.objects.get(pk=1) 103 103 >>> cheese_blog = Blog.objects.get(name="Cheddar Talk") 104 104 >>> entry.blog = cheese_blog … … 108 108 method on the field to add a record to the relation. This example adds the 109 109 ``Author`` instance ``joe`` to the ``entry`` object:: 110 110 111 >>> from mysite.blog.models import Author111 >>> from blog.models import Author 112 112 >>> joe = Author.objects.create(name="Joe") 113 113 >>> entry.authors.add(joe) 114 114 -
docs/topics/generic-views.txt
72 72 73 73 from django.conf.urls.defaults import * 74 74 from django.views.generic.simple import direct_to_template 75 **from mysite.books.views import about_pages**75 **from books.views import about_pages** 76 76 77 77 urlpatterns = patterns('', 78 78 ('^about/$', direct_to_template, { … … 152 152 153 153 from django.conf.urls.defaults import * 154 154 from django.views.generic import list_detail 155 from mysite.books.models import Publisher155 from books.models import Publisher 156 156 157 157 publisher_info = { 158 158 "queryset" : Publisher.objects.all(), … … 251 251 252 252 .. parsed-literal:: 253 253 254 from mysite.books.models import Publisher, **Book**254 from books.models import Publisher, **Book** 255 255 256 256 publisher_info = { 257 257 "queryset" : Publisher.objects.all(), … … 376 376 377 377 .. parsed-literal:: 378 378 379 from mysite.books.views import books_by_publisher379 from books.views import books_by_publisher 380 380 381 381 urlpatterns = patterns('', 382 382 (r'^publishers/$', list_detail.object_list, publisher_info), … … 387 387 388 388 from django.http import Http404 389 389 from django.views.generic import list_detail 390 from mysite.books.models import Book, Publisher390 from books.models import Book, Publisher 391 391 392 392 def books_by_publisher(request, name): 393 393 … … 447 447 448 448 .. parsed-literal:: 449 449 450 from mysite.books.views import author_detail450 from books.views import author_detail 451 451 452 452 urlpatterns = patterns('', 453 453 #... … … 457 457 Then we'd write our wrapper function:: 458 458 459 459 import datetime 460 from mysite.books.models import Author460 from books.models import Author 461 461 from django.views.generic import list_detail 462 462 from django.shortcuts import get_object_or_404 463 463 -
docs/ref/contrib/formtools/form-wizard.txt
193 193 arguments when you instantiate the Wizard:: 194 194 195 195 from django.conf.urls.defaults import * 196 from mysite.testapp.forms import ContactForm1, ContactForm2, ContactWizard196 from testapp.forms import ContactForm1, ContactForm2, ContactWizard 197 197 198 198 urlpatterns = patterns('', 199 199 (r'^contact/$', ContactWizard([ContactForm1, ContactForm2])),