Ticket #9000: doc-fixes-r8995.diff
File doc-fixes-r8995.diff, 26.2 KB (added by , 16 years ago) |
---|
-
django/conf/project_template/settings.py
diff -r 6469880f5067 django/conf/project_template/settings.py
a b MANAGERS = ADMINS 10 10 MANAGERS = ADMINS 11 11 12 12 DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 13 DATABASE_NAME = '' # Or path to database file if using sqlite3. 13 DATABASE_NAME = '' # Or full absolute path to database file if using sqlite3 (when 14 # specifying the path, always use forward slashes, even on Windows). 14 15 DATABASE_USER = '' # Not used with sqlite3. 15 16 DATABASE_PASSWORD = '' # Not used with sqlite3. 16 17 DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -
docs/internals/contributing.txt
diff -r 6469880f5067 docs/internals/contributing.txt
a b translated, here's what to do: 399 399 translated, here's what to do: 400 400 401 401 * Join the `Django i18n mailing list`_ and introduce yourself. 402 402 403 403 * Create translations using the methods described in the :ref:`i18n 404 404 documentation <topics-i18n>`. For this you will use the ``django-admin.py 405 405 makemessages`` tool. In this particular case it should be run from the 406 top-level ``django`` directory of the Django source tree.406 top-level ``django`` directory of the Django source tree. 407 407 408 408 The script runs over the entire Django source tree and pulls out all 409 409 strings marked for translation. It creates (or updates) a message file in 410 410 the directory ``conf/locale`` (for example for ``pt-BR``, the file will be 411 411 ``conf/locale/pt-br/LC_MESSAGES/django.po``). 412 412 413 413 * Make sure that ``django-admin.py compilemessages -l <lang>`` runs without 414 414 producing any warnings. 415 415 416 416 * Repeat the last two steps for the ``djangojs`` domain (by appending the 417 417 ``-d djangojs`` command line option to the ``django-admin.py`` 418 invocations. 419 418 invocations.) 419 420 420 * Create a diff of the ``.po`` file(s) against the current Subversion trunk. 421 421 422 422 * Open a ticket in Django's ticket system, set its ``Component`` field to 423 423 ``Translations``, and attach the patch to it. 424 424 -
docs/internals/documentation.txt
diff -r 6469880f5067 docs/internals/documentation.txt
a b semantic markup you can add the better. 28 28 semantic markup you can add the better. So:: 29 29 30 30 Add ``django.contrib.auth`` to your ``INSTALLED_APPS``... 31 31 32 32 Isn't nearly as helpful as:: 33 33 34 34 Add :mod:`django.contrib.auth` to your :setting:`INSTALLED_APPS`... 35 36 This is because Sphinx will generate proper links for the lat er, which greatly35 36 This is because Sphinx will generate proper links for the latter, which greatly 37 37 helps readers. There's basically no limit to the amount of useful markup you can 38 38 add. 39 39 … … __ http://sphinx.pocoo.org/markup/desc.h 45 45 __ http://sphinx.pocoo.org/markup/desc.html 46 46 47 47 * Settings:: 48 48 49 49 .. setting:: INSTALLED_APPS 50 50 51 51 To link to a setting, use ``:setting:`INSTALLED_APPS```. 52 52 53 53 * Template tags:: 54 54 55 55 .. templatetag:: regroup 56 56 57 57 To link, use ``:ttag:`regroup```. 58 58 59 59 * Template filters:: 60 60 61 61 .. templatefilter:: linebreaksbr 62 62 63 63 To link, use ``:tfilter:`linebreaksbr```. 64 64 65 65 * Field lookups (i.e. ``Foo.objects.filter(bar__exact=whatever)``):: 66 66 67 67 .. fieldlookup:: exact 68 68 69 69 To link, use ``:lookup:`exact```. 70 70 71 71 * ``django-admin`` commands:: 72 72 73 73 .. django-admin:: syncdb 74 74 75 75 To link, use ``:djadmin:`syncdb```. 76 76 77 77 * ``django-admin`` command-line options:: 78 78 79 79 .. django-admin-option:: --traceback 80 80 81 81 To link, use ``:djadminopt:`--traceback```. 82 82 83 83 An example … … For a quick example of how it all fits t 86 86 For a quick example of how it all fits together, check this out: 87 87 88 88 * First, the ``ref/settings.txt`` document starts out like this:: 89 89 90 90 .. _ref-settings: 91 91 92 92 Available settings 93 93 ================== 94 94 95 95 ... 96 96 97 97 * Next, if you look at the ``topics/settings.txt`` document, you can see how 98 98 a link to ``ref/settings`` works:: 99 99 100 100 Available settings 101 101 ================== 102 102 103 103 For a full list of available settings, see the :ref:`settings reference 104 104 <ref-settings>`. 105 105 106 106 * Next, notice how the settings (right now just the top few) are annotated:: 107 107 108 108 .. setting:: ADMIN_FOR 109 109 110 110 ADMIN_FOR … … For a quick example of how it all fits t 115 115 Used for admin-site settings modules, this should be a tuple of settings 116 116 modules (in the format ``'foo.bar.baz'``) for which this site is an 117 117 admin. 118 118 119 119 The admin site uses this in its automatically-introspected 120 120 documentation of models, views and template tags. 121 121 122 122 This marks up the following header as the "canonical" target for the 123 123 setting ``ADMIN_FOR`` This means any time I talk about ``ADMIN_FOR``, I 124 124 can reference it using ``:setting:`ADMIN_FOR```. 125 125 126 126 That's basically how everything fits together. 127 127 128 128 TODO … … The work is mostly done, but here's what 134 134 this TODO item my permission and license) into 135 135 ``topics/generic-views.txt``; remove the intro material from 136 136 ``ref/generic-views.txt`` and just leave the function reference. 137 137 138 138 * Change the "Added/changed in development version" callouts to proper 139 139 Sphinx ``.. versionadded::`` or ``.. versionchanged::`` directives. 140 140 141 141 * Check for and fix malformed links. Do this by running ``make linkcheck`` 142 142 and fix all of the 300+ errors/warnings. 143 144 In particular, look at all the relative links; these need to be 143 144 In particular, look at all the relative links; these need to be 145 145 changed to proper references. 146 146 147 147 * Most of the various ``index.txt`` documents have *very* short or even 148 148 non-existent intro text. Each of those documents needs a good short intro 149 149 the content below that point. 150 150 151 151 * The glossary is very perfunctory. It needs to be filled out. 152 152 153 153 * Add more metadata targets: there's lots of places that look like:: 154 154 155 155 ``File.close()`` 156 156 ~~~~~~~~~~~~~~~~ 157 157 158 158 \... these should be:: 159 159 160 160 .. method:: File.close() 161 161 162 162 That is, use metadata instead of titles. 163 163 164 164 * Add more links -- nearly everything that's an inline code literal 165 right now can probably be turned into a xref. 166 165 right now can probably be turned into a xref. 166 167 167 See the ``literals_to_xrefs.py`` file in ``_ext`` -- it's a shell script 168 168 to help do this work. 169 169 170 170 This will probably be a continuing, never-ending project. 171 171 172 172 * Add `info field lists`__ where appropriate. 173 173 174 174 __ http://sphinx.pocoo.org/markup/desc.html#info-field-lists 175 175 176 176 * Add ``.. code-block:: <lang>`` to literal blocks so that they get 177 177 highlighted. 178 178 … … Some hints for making things look/read b 189 189 "crossref" directives. Others (``.. class::``, e.g.) generate their own 190 190 markup; these should go inside the section they're describing. These are 191 191 called "description units". 192 192 193 193 You can tell which are which by looking at in :file:`_ext/djangodocs.py`; 194 194 it registers roles as one of the other. 195 195 196 196 * When referring to classes/functions/modules, etc., you'll want to use the 197 197 fully-qualified name of the target 198 (``:class:`django.contrib.contenttypes.models.ContentType```). 199 198 (``:class:`django.contrib.contenttypes.models.ContentType```). 199 200 200 Since this doesn't look all that awesome in the output -- it shows the 201 201 entire path to the object -- you can prefix the target with a ``~`` 202 202 (that's a tilde) to get just the "last bit" of that path. So -
docs/intro/tutorial01.txt
diff -r 6469880f5067 docs/intro/tutorial01.txt
a b create a ``mysite`` directory in your cu 42 42 create a ``mysite`` directory in your current directory. 43 43 44 44 .. admonition:: Mac OS X permissions 45 45 46 46 If you're using Mac OS X, you may see the message "permission denied" when 47 47 you try to run ``django-admin.py startproject``. This is because, on 48 48 Unix-based systems like OS X, a file must be marked as "executable" before it 49 49 can be run as a program. To do this, open Terminal.app and navigate (using 50 50 the ``cd`` command) to the directory where :ref:`django-admin.py 51 <ref-django-admin>` is installed, then run the command 51 <ref-django-admin>` is installed, then run the command 52 52 ``chmod +x django-admin.py``. 53 53 54 54 .. note:: … … These files are: 90 90 * :file:`__init__.py`: An empty file that tells Python that this directory 91 91 should be considered a Python package. (Read `more about packages`_ in the 92 92 official Python docs if you're a Python beginner.) 93 93 94 94 * :file:`manage.py`: A command-line utility that lets you interact with this 95 95 Django project in various ways. You can read all the details about 96 96 :file:`manage.py` in :ref:`ref-django-admin`. 97 97 98 98 * :file:`settings.py`: Settings/configuration for this Django project. 99 99 :ref:`topics-settings` will tell you all about how settings work. 100 100 101 101 * :file:`urls.py`: The URL declarations for this Django project; a "table of 102 102 contents" of your Django-powered site. You can read more about URLs in 103 103 :ref:`topics-http-urls`. … … It worked! 137 137 on port 8000. If you want to change the server's port, pass it as a 138 138 command-line argument. For instance, this command starts the server on port 139 139 8080: 140 140 141 141 .. code-block:: bash 142 142 143 143 python manage.py runserver 8080 … … database's connection parameters: 155 155 156 156 * :setting:`DATABASE_ENGINE` -- Either 'postgresql_psycopg2', 'mysql' or 157 157 'sqlite3'. Other backends are :setting:`also available <DATABASE_ENGINE>`. 158 158 159 159 * :setting:`DATABASE_NAME` -- The name of your database. If you're using 160 160 SQLite, the database will be a file on your computer; in that case, 161 161 ``DATABASE_NAME`` should be the full absolute path, including filename, of 162 162 that file. If the file doesn't exist, it will automatically be created 163 163 when you synchronize the database for the first time (see below). 164 164 When specifying the path, always use forward slashes, even on Windows 165 (e.g. ``C:/homes/user/mysite/sqlite3.db``). 166 165 167 * :setting:`DATABASE_USER` -- Your database username (not used for SQLite). 166 168 167 169 * :setting:`DATABASE_PASSWORD` -- Your database password (not used for 168 170 SQLite). 169 171 170 172 * :setting:`DATABASE_HOST` -- The host your database is on. Leave this as an 171 173 empty string if your database server is on the same physical machine (not 172 174 used for SQLite). … … prompt, but also because objects' repres 582 584 prompt, but also because objects' representations are used throughout Django's 583 585 automatically-generated admin. 584 586 585 .. admonition:: Why :meth:`~django.db.models.Model.__unicode__` and not 587 .. admonition:: Why :meth:`~django.db.models.Model.__unicode__` and not 586 588 :meth:`django.db.models.Model.__str__`? 587 589 588 590 If you're familiar with Python, you might be in the habit of adding -
docs/ref/databases.txt
diff -r 6469880f5067 docs/ref/databases.txt
a b Connecting to the database 159 159 Connecting to the database 160 160 -------------------------- 161 161 162 Refer to the :ref:`settings documentation <ref-settings>`. 162 Refer to the :ref:`settings documentation <ref-settings>`. 163 163 164 164 Connection settings are used in this order: 165 165 … … matter unless you're printing out the fi 242 242 243 243 .. _sqlite-notes: 244 244 245 SQLite notes 246 ============ 247 248 Versions of SQLite 3.3.5 and older `contain a bug`_ when handling ``ORDER BY``249 parameters. This can cause problems when you use the ``select`` parameter for 250 the ``extra()`` QuerySet method. The bug can be identified by the error message251 ``OperationalError: ORDER BY terms must not be non-integer constants``. The 252 problem can be solved updating SQLite to version 3.3.6 or newer, possibly also 253 updating the ``pysqlite2`` Python module in the process.254 255 .. _ contain a bug: http://www.sqlite.org/cvstrac/tktview?tn=1768256 257 This has a very low impact because 3.3.6 was released in April 2006, so most 258 current binary distributions for different platforms include newer version of 259 SQLite usable from Python through either the ``pysqlite2`` or the ``sqlite3`` 260 modules. 261 262 However, in the case of Windows, the official binary distribution of the stable 263 release of Python 2.5 (2.5.2, as of this writing) includes SQLite 3.3.4, so the bug can 264 make itself evident in that platform. There are (as of Django 1.0) even three 265 tests in the Django test suite that will fail when run under this setup. As 266 described above, this can be solved by downloading and installing a newer 267 version of ``pysqlite2`` (``pysqlite-2.x.x.win32-py2.5.exe``) that includes and 268 uses a newer version of SQLite. Python 2.6 ships with a newer version of 269 SQLite and is not beaffected by this issue.270 271 If you are in such platform and find yourself in the need to update 272 ``pysqlite``/SQLite, you will also need to manually modify the 273 ``django/db/backends/sqlite3/base.py`` file in the Django source tree so it 274 attempts to import ``pysqlite2`` before tha t ``sqlite3`` and so it can take245 SQLite notes 246 ============ 247 248 Versions of SQLite 3.3.5 and older contain a `bug`_ in the handling of 249 ``ORDER BY`` parameters. This can cause problems when you use the ``select`` 250 parameter of the ``extra()`` QuerySet method. The bug can be identified by the 251 error message ``"OperationalError: ORDER BY terms must not be non-integer 252 constants"``. The problem can be solved updating SQLite to version 3.3.6 or 253 newer, possibly also updating the ``pysqlite2`` Python module in the process. 254 255 .. _bug: http://www.sqlite.org/cvstrac/tktview?tn=1768 256 257 This has a very low impact because 3.3.6 was released in April 2006, so most 258 current binary distributions for different platforms include newer version of 259 SQLite usable from Python through either the ``pysqlite2`` or the ``sqlite3`` 260 modules. 261 262 However, in the case of Windows, the official binary distribution of the stable 263 release of Python 2.5 (2.5.2, as of this writing) includes SQLite 3.3.4, so the bug can 264 make itself evident in that platform. There are (as of Django 1.0) even three 265 tests in the Django test suite that will fail when run under this setup. As 266 described above, this can be solved by downloading and installing a newer 267 version of ``pysqlite2`` (``pysqlite-2.x.x.win32-py2.5.exe``) that includes and 268 uses a newer version of SQLite. Python 2.6 ships with a newer version of 269 SQLite and is not affected by this issue. 270 271 If you are in such platform and find yourself in the need to update 272 ``pysqlite``/SQLite, you will also need to manually modify the 273 ``django/db/backends/sqlite3/base.py`` file in the Django source tree so it 274 attempts to import ``pysqlite2`` before than ``sqlite3`` and then it can take 275 275 advantage of the new ``pysqlite2``/SQLite versions. 276 276 277 277 .. _oracle-notes: … … database user must have privileges to ru 293 293 * CREATE SEQUENCE 294 294 * CREATE PROCEDURE 295 295 * CREATE TRIGGER 296 296 297 297 To run Django's test suite, the user needs these *additional* privileges: 298 298 299 299 * CREATE USER 300 300 * DROP USER 301 301 * CREATE TABLESPACE 302 302 * DROP TABLESPACE 303 303 304 304 Connecting to the database 305 305 -------------------------- 306 306 -
docs/ref/generic-views.txt
diff -r 6469880f5067 docs/ref/generic-views.txt
a b a date in the *future* are not included 198 198 specified in ``date_field`` is greater than the current date/time. By 199 199 default, this is ``False``. 200 200 201 .. versionadded:: 1.0201 .. versionadded:: 1.0 202 202 203 203 * ``template_object_name``: Designates the name of the template variable 204 204 to use in the template context. By default, this is ``'latest'``. … … In addition to ``extra_context``, the te 224 224 ordered in reverse. This is equivalent to 225 225 ``queryset.dates(date_field, 'year')[::-1]``. 226 226 227 .. versionchanged:: 1.0228 227 .. versionchanged:: 1.0 228 The behaviour depending on ``template_object_name`` is new in this version. 229 229 230 230 * ``latest``: The ``num_latest`` objects in the system, ordered descending 231 231 by ``date_field``. For example, if ``num_latest`` is ``10``, then … … specify the page number in the URL in on 772 772 773 773 /objects/?page=3 774 774 775 * To loop over all the available page numbers, use the ``page_range`` 776 variable. You can iterate over the list provided by ``page_range`` 775 * To loop over all the available page numbers, use the ``page_range`` 776 variable. You can iterate over the list provided by ``page_range`` 777 777 to create a link to every page of results. 778 778 779 779 These values and lists are 1-based, not 0-based, so the first page would be 780 represented as page ``1``. 780 represented as page ``1``. 781 781 782 782 For more on pagination, read the :ref:`pagination documentation 783 783 <topics-pagination>`. … … As a special case, you are also permitte 789 789 790 790 /objects/?page=last 791 791 792 This allows you to access the final page of results without first having to 792 This allows you to access the final page of results without first having to 793 793 determine how many pages there are. 794 794 795 795 Note that ``page`` *must* be either a valid page number or the value ``last``; … … library <topics-forms-index>` to build a 880 880 **Description:** 881 881 882 882 A page that displays a form for creating an object, redisplaying the form with 883 validation errors (if there are any) and saving the object. 883 validation errors (if there are any) and saving the object. 884 884 885 885 **Required arguments:** 886 886 -
docs/ref/models/querysets.txt
diff -r 6469880f5067 docs/ref/models/querysets.txt
a b QuerySet API reference 7 7 .. currentmodule:: django.db.models 8 8 9 9 This document describes the details of the ``QuerySet`` API. It builds on the 10 material presented in the :ref:`model <topics-db-models>` and `database query11 <topics-db-queries>` guides, so you'll probably want to read and understand12 those documents before reading this one.10 material presented in the :ref:`model <topics-db-models>` and :ref:`database 11 query <topics-db-queries>` guides, so you'll probably want to read and 12 understand those documents before reading this one. 13 13 14 14 Throughout this reference we'll use the :ref:`example weblog models 15 15 <queryset-model-example>` presented in the :ref:`database query guide … … respect to case-sensitivity, Django will 192 192 respect to case-sensitivity, Django will order results however your database 193 193 backend normally orders them. 194 194 195 ``reverse()`` 196 ~~~~~~~~~~~~~ 197 198 .. versionadded:: 1.0 199 200 Use the ``reverse()`` method to reverse the order in which a queryset's 201 elements are returned. Calling ``reverse()`` a second time restores the 202 ordering back to the normal direction. 203 204 To retrieve the ''last'' five items in a queryset, you could do this:: 205 206 my_queryset.reverse()[:5] 207 208 Note that this is not quite the same as slicing from the end of a sequence in 209 Python. The above example will return the last item first, then the 210 penultimate item and so on. If we had a Python sequence and looked at 211 ``seq[-5:]``, we would see the fifth-last item first. Django doesn't support 212 that mode of access (slicing from the end), because it's not possible to do it 213 efficiently in SQL. 214 195 215 Also, note that ``reverse()`` should generally only be called on a 196 216 ``QuerySet`` which has a defined ordering (e.g., when querying against 197 217 a model which defines a default ordering, or when using … … a model which defines a default ordering 199 219 ``QuerySet``, calling ``reverse()`` on it has no real effect (the 200 220 ordering was undefined prior to calling ``reverse()``, and will remain 201 221 undefined afterward). 202 203 222 204 223 ``distinct()`` 205 224 ~~~~~~~~~~~~~~ … … Examples:: 392 411 393 412 >>> Entry.objects.none() 394 413 [] 414 415 ``all()`` 416 ~~~~~~~~~~ 417 418 .. versionadded:: 1.0 419 420 Returns a ''copy'' of the current ``QuerySet`` (or ``QuerySet`` subclass you 421 pass in). This can be useful in some situations where you might want to pass 422 in either a model manager or a ``QuerySet`` and do further filtering on the 423 result. You can safely call ``all()`` on either object and then you'll 424 definitely have a ``QuerySet`` to work with. 395 425 396 426 .. _select-related: 397 427 -
docs/ref/settings.txt
diff -r 6469880f5067 docs/ref/settings.txt
a b default port. Not used with SQLite. 224 224 default port. Not used with SQLite. 225 225 226 226 .. setting:: DATABASE_USER 227 227 228 228 DATABASE_USER 229 229 ------------- 230 230 … … and ``MONTH_DAY_FORMAT``. 247 247 and ``MONTH_DAY_FORMAT``. 248 248 249 249 .. setting:: DATETIME_FORMAT 250 250 251 251 DATETIME_FORMAT 252 252 --------------- 253 253 … … system's standard umask. 515 515 .. warning:: 516 516 517 517 **Always prefix the mode with a 0.** 518 518 519 519 If you're not familiar with file modes, please note that the leading 520 520 ``0`` is very important: it indicates an octal number, which is the 521 521 way that modes must be specified. If you try to use ``644``, you'll 522 522 get totally incorrect behavior. 523 524 523 525 .. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html 524 525 .. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html 526 526 527 527 .. setting:: FIXTURE_DIRS 528 528 … … Normally, Django sets the ``os.environ[' 1152 1152 Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you 1153 1153 specify in the ``TIME_ZONE`` setting. Thus, all your views and models will 1154 1154 automatically operate in the correct time zone. However, if you're using the 1155 manual configuration option (see below), Django will *not* touch the ``TZ`` 1156 environment variable, and it'll be up to you to ensure your processes are 1157 running in the correct environment. 1155 manual configuration option (see :ref:`Using settings without setting DJANGO 1156 SETTINGS_MODULE <settings-without-django-settings-module>`), Django will *not* 1157 touch the ``TZ`` environment variable, and it'll be up to you to ensure your 1158 processes are running in the correct environment. 1158 1159 1159 1160 .. note:: 1160 1161 Django cannot reliably use alternate time zones in a Windows environment. 1161 1162 If you're running Django on Windows, this variable must be set to match the 1162 1163 system timezone. 1163 1164 1164 1165 .. _See available choices: http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE 1165 1166 1166 1167 .. setting:: URL_VALIDATOR_USER_AGENT -
docs/topics/i18n.txt
diff -r 6469880f5067 docs/topics/i18n.txt
a b If you don't like the verbose name ``uge 184 184 class MyThing(models.Model): 185 185 name = models.CharField(help_text=_('This is the help text')) 186 186 187 Always use lazy translations in :ref:`Django models <topics-db-models>`. It's a 188 good idea to add translations for the field names and table names, too. This 189 means writing explicit ``verbose_name`` and ``verbose_name_plural`` options in 190 the ``Meta`` class, though:: 187 Always use lazy translations in :ref:`Django models <topics-db-models>`. Field 188 names and table names must be marked for translation otherwise, for example, 189 they will not be translated in the admin interface. This means writing explicit 190 ``verbose_name`` and ``verbose_name_plural`` options in the ``Meta`` class, 191 though: 191 192 192 193 from django.utils.translation import ugettext_lazy as _ 193 194 … … Each ``RequestContext`` has access to th 277 278 278 279 * ``LANGUAGE_CODE`` is the current user's preferred language, as a string. 279 280 Example: ``en-us``. (See "How language preference is discovered", below.) 280 281 281 282 * ``LANGUAGE_BIDI`` is the current locale's direction. If True, it's a 282 283 right-to-left language, e.g.: Hebrew, Arabic. If False it's a 283 284 left-to-right language, e.g.: English, French, German etc. … … following this algorithm: 591 592 592 593 * First, it looks for a ``django_language`` key in the current user's 593 594 session. 594 595 595 596 * Failing that, it looks for a cookie. 596 597 597 598 .. versionchanged:: 1.0 598 599 599 600 In Django version 0.96 and before, the cookie's name is hard-coded to 600 601 ``django_language``. In Django 1,0, The cookie name is set by the 601 602 ``LANGUAGE_COOKIE_NAME`` setting. (The default name is 602 603 ``django_language``.) 603 604 604 605 * Failing that, it looks at the ``Accept-Language`` HTTP header. This 605 606 header is sent by your browser and tells the server which language(s) you 606 607 prefer, in order by priority. Django tries each language in the header 607 608 until it finds one with available translations. 608 609 609 610 * Failing that, it uses the global ``LANGUAGE_CODE`` setting. 610 611 611 612 .. _locale-middleware-notes: … … Notes: 615 616 * In each of these places, the language preference is expected to be in the 616 617 standard language format, as a string. For example, Brazilian Portuguese 617 618 is ``pt-br``. 618 619 619 620 * If a base language is available but the sublanguage specified is not, 620 621 Django uses the base language. For example, if a user specifies ``de-at`` 621 622 (Austrian German) but Django only has ``de`` available, Django uses 622 623 ``de``. 623 624 624 625 * Only languages listed in the :setting:`LANGUAGES` setting can be selected. 625 626 If you want to restrict the language selection to a subset of provided 626 627 languages (because your application doesn't provide all those languages),