Loading docs/intro/contributing.txt +2 −3 Original line number Diff line number Diff line Loading @@ -20,8 +20,8 @@ For this tutorial, we expect that you have at least a basic understanding of how Django works. This means you should be comfortable going through the existing tutorials on :doc:`writing your first Django app</intro/tutorial01>`. In addition, you should have a good understanding of Python itself. But if you don't, "Dive Into Python" (for `Python 2`__, for `Python 3`__) is a fantastic (and free) online book for beginning Python programmers. don't, `Dive Into Python`__ is a fantastic (and free) online book for beginning Python programmers. Those of you who are unfamiliar with version control systems and Trac will find that this tutorial and its links include just enough information to get started. Loading @@ -37,7 +37,6 @@ so that it can be of use to the widest audience. to |django-developers| or drop by `#django-dev on irc.freenode.net`__ to chat with other Django users who might be able to help. __ http://diveintopython.net/toc/index.html __ http://diveintopython3.net/ __ irc://irc.freenode.net/django-dev Loading docs/intro/index.txt +3 −7 Original line number Diff line number Diff line Loading @@ -29,14 +29,10 @@ place: read this material to quickly get up and running. `list of Python resources for non-programmers`_ If you already know a few other languages and want to get up to speed with Python quickly, we recommend "Dive Into Python" (for `Python 2`_, for `Python 3`_, also available in a `dead-tree version`_). If that's not quite your style, there are quite a few other `books about Python`_. Python quickly, we recommend `Dive Into Python`_. If that's not quite your style, there are many other `books about Python`_. .. _python: http://python.org/ .. _list of Python resources for non-programmers: https://wiki.python.org/moin/BeginnersGuide/NonProgrammers .. _Python 2: http://diveintopython.net/ .. _Python 3: http://diveintopython3.net/ .. _dead-tree version: http://www.amazon.com/exec/obidos/ASIN/1590593561/ref=nosim/jacobian20 .. _Dive Into Python: http://diveintopython3.net/ .. _books about Python: https://wiki.python.org/moin/PythonBooks docs/intro/install.txt +4 −4 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ SQLite_ so you won't need to set up a database just yet. .. _sqlite: http://sqlite.org/ Get Python at http://www.python.org. If you're running Linux or Mac OS X, you probably already have it installed. Get the latest version of Python at http://www.python.org/download/ or with your operating system's package manager. .. admonition:: Django on Jython Loading @@ -28,8 +28,8 @@ probably already have it installed. You can verify that Python is installed by typing ``python`` from your shell; you should see something like:: Python 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2] on linux2 Python 3.3.3 (default, Nov 26 2013, 13:33:18) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> Loading docs/intro/overview.txt +11 −12 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ code. .. _object-relational mapper: http://en.wikipedia.org/wiki/Object-relational_mapping 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 representing your models -- so far, it's been solving many years' worth of database-schema problems. Here's a quick example, which might be saved in the file ``mysite/news/models.py``:: Loading @@ -31,8 +31,7 @@ the file ``mysite/news/models.py``:: class Reporter(models.Model): full_name = models.CharField(max_length=70) # On Python 3: def __str__(self): def __unicode__(self): def __str__(self): # __unicode__ on Python 2 return self.full_name class Article(models.Model): Loading @@ -41,8 +40,7 @@ the file ``mysite/news/models.py``:: content = models.TextField() reporter = models.ForeignKey(Reporter) # On Python 3: def __str__(self): def __unicode__(self): def __str__(self): # __unicode__ on Python 2 return self.headline Install it Loading Loading @@ -127,7 +125,7 @@ necessary: # The API follows relationships as far as you need, performing efficient # JOINs for you behind the scenes. # This finds all articles by a reporter whose name starts with "John". >>> Article.objects.filter(reporter__full_name__startswith="John") >>> Article.objects.filter(reporter__full_name__startswith='John') [<Article: Django is cool>] # Change an object by altering its attributes and calling save(). Loading Loading @@ -224,11 +222,12 @@ Generally, a view retrieves data according to the parameters, loads a template and renders the template with the retrieved data. Here's an example view for ``year_archive`` from above:: from django.shortcuts import render_to_response from django.shortcuts import render def year_archive(request, year): a_list = Article.objects.filter(pub_date__year=year) return render_to_response('news/year_archive.html', {'year': year, 'article_list': a_list}) context = {'year': year, 'article_list': a_list} return render(request, 'news/year_archive.html', context) This example uses Django's :doc:`template system </topics/templates>`, which has several powerful features but strives to stay simple enough for non-programmers Loading Loading @@ -265,7 +264,7 @@ might look like: Variables are surrounded by double-curly braces. ``{{ article.headline }}`` means "Output the value of the article's headline attribute." But dots aren't used only for attribute lookup: They also can do dictionary-key lookup, index used only for attribute lookup. They also can do dictionary-key lookup, index lookup and function calls. Note ``{{ article.pub_date|date:"F j, Y" }}`` uses a Unix-style "pipe" (the "|" Loading @@ -278,7 +277,7 @@ template filters <howto-writing-custom-template-filters>`. You can write :doc:`custom template tags </howto/custom-template-tags>`, which run custom Python code behind the scenes. Finally, Django uses the concept of "template inheritance": That's what the Finally, Django uses the concept of "template inheritance". That's what the ``{% extends "base.html" %}`` does. It means "First load the template called 'base', which has defined a bunch of blocks, and fill the blocks with the following blocks." In short, that lets you dramatically cut down on redundancy Loading Loading @@ -306,8 +305,8 @@ easy as changing a single file -- the base template. It also lets you create multiple versions of a site, with different base templates, while reusing child templates. Django's creators have used this technique to create strikingly different cell-phone editions of sites -- simply by creating a new base template. technique to create strikingly different mobile versions of sites -- simply by creating a new base template. Note that you don't have to use Django's template system if you prefer another system. While Django's template system is particularly well-integrated with Loading docs/intro/reusable-apps.txt +4 −3 Original line number Diff line number Diff line Loading @@ -215,9 +215,10 @@ this. For a small app like polls, this process isn't too difficult. 'License :: OSI Approved :: BSD License', # example license 'Operating System :: OS Independent', 'Programming Language :: Python', # replace these appropriately if you are using Python 3 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', # Replace these appropriately if you are stuck on Python 2. 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], Loading Loading
docs/intro/contributing.txt +2 −3 Original line number Diff line number Diff line Loading @@ -20,8 +20,8 @@ For this tutorial, we expect that you have at least a basic understanding of how Django works. This means you should be comfortable going through the existing tutorials on :doc:`writing your first Django app</intro/tutorial01>`. In addition, you should have a good understanding of Python itself. But if you don't, "Dive Into Python" (for `Python 2`__, for `Python 3`__) is a fantastic (and free) online book for beginning Python programmers. don't, `Dive Into Python`__ is a fantastic (and free) online book for beginning Python programmers. Those of you who are unfamiliar with version control systems and Trac will find that this tutorial and its links include just enough information to get started. Loading @@ -37,7 +37,6 @@ so that it can be of use to the widest audience. to |django-developers| or drop by `#django-dev on irc.freenode.net`__ to chat with other Django users who might be able to help. __ http://diveintopython.net/toc/index.html __ http://diveintopython3.net/ __ irc://irc.freenode.net/django-dev Loading
docs/intro/index.txt +3 −7 Original line number Diff line number Diff line Loading @@ -29,14 +29,10 @@ place: read this material to quickly get up and running. `list of Python resources for non-programmers`_ If you already know a few other languages and want to get up to speed with Python quickly, we recommend "Dive Into Python" (for `Python 2`_, for `Python 3`_, also available in a `dead-tree version`_). If that's not quite your style, there are quite a few other `books about Python`_. Python quickly, we recommend `Dive Into Python`_. If that's not quite your style, there are many other `books about Python`_. .. _python: http://python.org/ .. _list of Python resources for non-programmers: https://wiki.python.org/moin/BeginnersGuide/NonProgrammers .. _Python 2: http://diveintopython.net/ .. _Python 3: http://diveintopython3.net/ .. _dead-tree version: http://www.amazon.com/exec/obidos/ASIN/1590593561/ref=nosim/jacobian20 .. _Dive Into Python: http://diveintopython3.net/ .. _books about Python: https://wiki.python.org/moin/PythonBooks
docs/intro/install.txt +4 −4 Original line number Diff line number Diff line Loading @@ -15,8 +15,8 @@ SQLite_ so you won't need to set up a database just yet. .. _sqlite: http://sqlite.org/ Get Python at http://www.python.org. If you're running Linux or Mac OS X, you probably already have it installed. Get the latest version of Python at http://www.python.org/download/ or with your operating system's package manager. .. admonition:: Django on Jython Loading @@ -28,8 +28,8 @@ probably already have it installed. You can verify that Python is installed by typing ``python`` from your shell; you should see something like:: Python 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2] on linux2 Python 3.3.3 (default, Nov 26 2013, 13:33:18) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> Loading
docs/intro/overview.txt +11 −12 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ code. .. _object-relational mapper: http://en.wikipedia.org/wiki/Object-relational_mapping 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 representing your models -- so far, it's been solving many years' worth of database-schema problems. Here's a quick example, which might be saved in the file ``mysite/news/models.py``:: Loading @@ -31,8 +31,7 @@ the file ``mysite/news/models.py``:: class Reporter(models.Model): full_name = models.CharField(max_length=70) # On Python 3: def __str__(self): def __unicode__(self): def __str__(self): # __unicode__ on Python 2 return self.full_name class Article(models.Model): Loading @@ -41,8 +40,7 @@ the file ``mysite/news/models.py``:: content = models.TextField() reporter = models.ForeignKey(Reporter) # On Python 3: def __str__(self): def __unicode__(self): def __str__(self): # __unicode__ on Python 2 return self.headline Install it Loading Loading @@ -127,7 +125,7 @@ necessary: # The API follows relationships as far as you need, performing efficient # JOINs for you behind the scenes. # This finds all articles by a reporter whose name starts with "John". >>> Article.objects.filter(reporter__full_name__startswith="John") >>> Article.objects.filter(reporter__full_name__startswith='John') [<Article: Django is cool>] # Change an object by altering its attributes and calling save(). Loading Loading @@ -224,11 +222,12 @@ Generally, a view retrieves data according to the parameters, loads a template and renders the template with the retrieved data. Here's an example view for ``year_archive`` from above:: from django.shortcuts import render_to_response from django.shortcuts import render def year_archive(request, year): a_list = Article.objects.filter(pub_date__year=year) return render_to_response('news/year_archive.html', {'year': year, 'article_list': a_list}) context = {'year': year, 'article_list': a_list} return render(request, 'news/year_archive.html', context) This example uses Django's :doc:`template system </topics/templates>`, which has several powerful features but strives to stay simple enough for non-programmers Loading Loading @@ -265,7 +264,7 @@ might look like: Variables are surrounded by double-curly braces. ``{{ article.headline }}`` means "Output the value of the article's headline attribute." But dots aren't used only for attribute lookup: They also can do dictionary-key lookup, index used only for attribute lookup. They also can do dictionary-key lookup, index lookup and function calls. Note ``{{ article.pub_date|date:"F j, Y" }}`` uses a Unix-style "pipe" (the "|" Loading @@ -278,7 +277,7 @@ template filters <howto-writing-custom-template-filters>`. You can write :doc:`custom template tags </howto/custom-template-tags>`, which run custom Python code behind the scenes. Finally, Django uses the concept of "template inheritance": That's what the Finally, Django uses the concept of "template inheritance". That's what the ``{% extends "base.html" %}`` does. It means "First load the template called 'base', which has defined a bunch of blocks, and fill the blocks with the following blocks." In short, that lets you dramatically cut down on redundancy Loading Loading @@ -306,8 +305,8 @@ easy as changing a single file -- the base template. It also lets you create multiple versions of a site, with different base templates, while reusing child templates. Django's creators have used this technique to create strikingly different cell-phone editions of sites -- simply by creating a new base template. technique to create strikingly different mobile versions of sites -- simply by creating a new base template. Note that you don't have to use Django's template system if you prefer another system. While Django's template system is particularly well-integrated with Loading
docs/intro/reusable-apps.txt +4 −3 Original line number Diff line number Diff line Loading @@ -215,9 +215,10 @@ this. For a small app like polls, this process isn't too difficult. 'License :: OSI Approved :: BSD License', # example license 'Operating System :: OS Independent', 'Programming Language :: Python', # replace these appropriately if you are using Python 3 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', # Replace these appropriately if you are stuck on Python 2. 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], Loading