summaryrefslogtreecommitdiff
path: root/docs/howto/outputting-csv.txt
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-09-04 21:17:30 +0000
committerRamiro Morales <cramm0@gmail.com>2011-09-04 21:17:30 +0000
commit932b1b8d6dbd1a4d8e50aa0528c1489094f5704c (patch)
tree2eabdbaca6daac3166847f77d3f06efc3dc2d928 /docs/howto/outputting-csv.txt
parent9110257a328bacae0a6131ca7b3c8b241fef128c (diff)
Converted links to external topics so they use intersphinx extension markup.
This allows to make these links more resilent to changes in the target URLs. Thanks Jannis for the report and Aymeric Augustin for the patch. Fixes #16586. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16720 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/howto/outputting-csv.txt')
-rw-r--r--docs/howto/outputting-csv.txt24
1 files changed, 10 insertions, 14 deletions
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt
index 46e111d8af..3e3d7d47ff 100644
--- a/docs/howto/outputting-csv.txt
+++ b/docs/howto/outputting-csv.txt
@@ -3,17 +3,15 @@ Outputting CSV with Django
==========================
This document explains how to output CSV (Comma Separated Values) dynamically
-using Django views. To do this, you can either use the `Python CSV library`_ or
-the Django template system.
-
-.. _Python CSV library: http://docs.python.org/library/csv.html
+using Django views. To do this, you can either use the Python CSV library or the
+Django template system.
Using the Python CSV library
============================
-Python comes with a CSV library, ``csv``. The key to using it with Django is
-that the ``csv`` module's CSV-creation capability acts on file-like objects, and
-Django's :class:`~django.http.HttpResponse` objects are file-like objects.
+Python comes with a CSV library, :mod:`csv`. The key to using it with Django is
+that the :mod:`csv` module's CSV-creation capability acts on file-like objects,
+and Django's :class:`~django.http.HttpResponse` objects are file-like objects.
Here's an example::
@@ -34,7 +32,7 @@ Here's an example::
The code and comments should be self-explanatory, but a few things deserve a
mention:
- * The response gets a special MIME type, ``text/csv``. This tells
+ * The response gets a special MIME type, :mimetype:`text/csv`. This tells
browsers that the document is a CSV file, rather than an HTML file. If
you leave this off, browsers will probably interpret the output as HTML,
which will result in ugly, scary gobbledygook in the browser window.
@@ -59,7 +57,7 @@ mention:
Handling Unicode
~~~~~~~~~~~~~~~~
-Python's ``csv`` module does not support Unicode input. Since Django uses
+Python's :mod:`csv` module does not support Unicode input. Since Django uses
Unicode internally this means strings read from sources such as
:class:`~django.http.HttpRequest` are potentially problematic. There are a few
options for handling this:
@@ -70,20 +68,18 @@ options for handling this:
section`_.
* Use the `python-unicodecsv module`_, which aims to be a drop-in
- replacement for ``csv`` that gracefully handles Unicode.
+ replacement for :mod:`csv` that gracefully handles Unicode.
-For more information, see the Python `CSV File Reading and Writing`_
-documentation.
+For more information, see the Python documentation of the :mod:`csv` module.
.. _`csv module's examples section`: http://docs.python.org/library/csv.html#examples
.. _`python-unicodecsv module`: https://github.com/jdunck/python-unicodecsv
-.. _`CSV File Reading and Writing`: http://docs.python.org/library/csv.html
Using the template system
=========================
Alternatively, you can use the :doc:`Django template system </topics/templates>`
-to generate CSV. This is lower-level than using the convenient Python ``csv``
+to generate CSV. This is lower-level than using the convenient Python :mod:`csv`
module, but the solution is presented here for completeness.
The idea here is to pass a list of items to your template, and have the