Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Copy edited new docs in docs/model-api.txt from [4535]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2fe64761809e636dc4efadde305c0b9509c30ca9 1 parent fa159c8
Adrian Holovaty authored February 18, 2007

Showing 1 changed file with 15 additions and 16 deletions. Show diff stats Hide diff stats

  1. 31  docs/model-api.txt
31  docs/model-api.txt
@@ -874,8 +874,8 @@ the relationship should work. All are optional:
874 874
                              force Django to add the descriptor for the reverse
875 875
                              relationship, allowing ``ManyToMany`` relationships to be
876 876
                              non-symmetrical.
877  
-			     
878  
-    ``db_table``             The name of the table to create for storing the many-to-many 
  877
+
  878
+    ``db_table``             The name of the table to create for storing the many-to-many
879 879
                              data. If this is not provided, Django will assume a default
880 880
                              name based upon the names of the two tables being joined.
881 881
 
@@ -1272,8 +1272,8 @@ A few special cases to note about ``list_display``:
1272 1272
                   return '<span style="color: #%s;">%s %s</span>' % (self.color_code, self.first_name, self.last_name)
1273 1273
               colored_name.allow_tags = True
1274 1274
 
1275  
-    * If the string given is a method of the model that returns True or False 
1276  
-      Django will display a pretty "on" or "off" icon if you give the method a 
  1275
+    * If the string given is a method of the model that returns True or False
  1276
+      Django will display a pretty "on" or "off" icon if you give the method a
1277 1277
       ``boolean`` attribute whose value is ``True``.
1278 1278
 
1279 1279
       Here's a full example model::
@@ -1412,7 +1412,7 @@ This should be set to a list of field names that will be searched whenever
1412 1412
 somebody submits a search query in that text box.
1413 1413
 
1414 1414
 These fields should be some kind of text field, such as ``CharField`` or
1415  
-``TextField``. You can also perform a related lookup on a ``ForeignKey`` with 
  1415
+``TextField``. You can also perform a related lookup on a ``ForeignKey`` with
1416 1416
 the lookup API "follow" notation::
1417 1417
 
1418 1418
     search_fields = ['foreign_key__related_fieldname']
@@ -1721,20 +1721,19 @@ But this template code is good::
1721 1721
 
1722 1722
     <a href="{{ object.get_absolute_url }}">{{ object.name }}</a>
1723 1723
 
1724  
-``permalink``
1725  
--------------
  1724
+The ``permalink`` decorator
  1725
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
1726 1726
 
1727  
-** New in Django development version. **
  1727
+**New in Django development version.**
1728 1728
 
1729 1729
 The problem with the way we wrote ``get_absolute_url()`` above is that it
1730 1730
 slightly violates the DRY principle: the URL for this object is defined both
1731 1731
 in the URLConf file and in the model.
1732 1732
 
1733  
-You can further decouple your models from the URL configuration using the
1734  
-``permalink`` function. This function acts as a decorator and is passed the
1735  
-view function and any parameters you would use for accessing this instance
1736  
-directly. Django then works out the correct full URL path using the URL
1737  
-configuration file. For example::
  1733
+You can further decouple your models from the URLconf using the ``permalink``
  1734
+decorator. This decorator is passed the view function and any parameters you
  1735
+would use for accessing this instance directly. Django then works out the
  1736
+correct full URL path using the URLconf. For example::
1738 1737
 
1739 1738
     from django.db.models import permalink
1740 1739
 
@@ -1742,9 +1741,9 @@ configuration file. For example::
1742 1741
         return ('people.views.details', str(self.id))
1743 1742
     get_absolute_url = permalink(get_absolute_url)
1744 1743
 
1745  
-In this way, you are tying the model's absolute URL to the view that is used
1746  
-to display it, without repeating the URL information anywhere. You still use
1747  
-the ``get_absolute_url`` method in templates, as before.
  1744
+In this way, you're tying the model's absolute URL to the view that is used
  1745
+to display it, without repeating the URL information anywhere. You can still
  1746
+use the ``get_absolute_url`` method in templates, as before.
1748 1747
 
1749 1748
 Executing custom SQL
1750 1749
 --------------------

0 notes on commit 2fe6476

Please sign in to comment.
Something went wrong with that request. Please try again.