Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #9939 -- Corrected minor error in model fields documentation. T…

…hanks to seemant for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9864 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a50a188a626a699dd205e05ab4caaa7963773132 1 parent af34608
Russell Keith-Magee authored February 22, 2009

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

  1. 74  docs/ref/models/fields.txt
74  docs/ref/models/fields.txt
@@ -10,7 +10,7 @@ Model field reference
10 10
 This document contains all the gory details about all the `field options`_ and
11 11
 `field types`_ Django's got to offer.
12 12
 
13  
-.. seealso:: 
  13
+.. seealso::
14 14
 
15 15
     If the built-in fields don't do the trick, you can easily :ref:`write your
16 16
     own custom model fields <howto-custom-model-fields>`.
@@ -128,10 +128,10 @@ be used for organizational purposes::
128 128
         ('unknown', 'Unknown'),
129 129
     )
130 130
 
131  
-The first element in each tuple is the name to apply to the group. The 
  131
+The first element in each tuple is the name to apply to the group. The
132 132
 second element is an iterable of 2-tuples, with each 2-tuple containing
133  
-a value and a human-readable name for an option. Grouped options may be 
134  
-combined with ungrouped options within a single list (such as the 
  133
+a value and a human-readable name for an option. Grouped options may be
  134
+combined with ungrouped options within a single list (such as the
135 135
 `unknown` option in this example).
136 136
 
137 137
 For each model field that has :attr:`~Field.choices` set, Django will add a
@@ -224,7 +224,7 @@ don't need to set ``primary_key=True`` on any of your fields unless you want to
224 224
 override the default primary-key behavior. For more, see
225 225
 :ref:`automatic-primary-key-fields`.
226 226
 
227  
-``primary_key=True`` implies :attr:`null=False <Field.null>` and :attr:`unique=True <Field.unique>`. 
  227
+``primary_key=True`` implies :attr:`null=False <Field.null>` and :attr:`unique=True <Field.unique>`.
228 228
 Only one primary key is allowed on an object.
229 229
 
230 230
 ``unique``
@@ -239,7 +239,7 @@ you try to save a model with a duplicate value in a :attr:`~Field.unique`
239 239
 field, a :exc:`django.db.IntegrityError` will be raised by the model's
240 240
 :meth:`~django.db.models.Model.save` method.
241 241
 
242  
-This options is valid on all field types except :class:`ManyToManyField`.
  242
+This option is valid on all field types except :class:`ManyToManyField`.
243 243
 
244 244
 ``unique_for_date``
245 245
 -------------------
@@ -274,9 +274,9 @@ Like :attr:`~Field.unique_for_date` and :attr:`~Field.unique_for_month`.
274 274
 
275 275
 Field types
276 276
 ===========
277  
-   
  277
+
278 278
 .. currentmodule:: django.db.models
279  
-   
  279
+
280 280
 ``AutoField``
281 281
 -------------
282 282
 
@@ -429,7 +429,7 @@ A :class:`CharField` that checks that the value is a valid e-mail address.
429 429
 A file-upload field. Has one **required** argument:
430 430
 
431 431
 .. attribute:: FileField.upload_to
432  
-    
  432
+
433 433
     A local filesystem path that will be appended to your :setting:`MEDIA_ROOT`
434 434
     setting to determine the value of the :attr:`~django.core.files.File.url`
435 435
     attribute.
@@ -437,7 +437,7 @@ A file-upload field. Has one **required** argument:
437 437
     This path may contain `strftime formatting`_, which will be replaced by the
438 438
     date/time of the file upload (so that uploaded files don't fill up the given
439 439
     directory).
440  
-    
  440
+
441 441
     .. versionchanged:: 1.0
442 442
 
443 443
     This may also be a callable, such as a function, which will be called to
@@ -445,31 +445,31 @@ A file-upload field. Has one **required** argument:
445 445
     to accept two arguments, and return a Unix-style path (with forward slashes)
446 446
     to be passed along to the storage system. The two arguments that will be
447 447
     passed are:
448  
-    
  448
+
449 449
         ======================  ===============================================
450  
-        Argument                Description                                    
  450
+        Argument                Description
451 451
         ======================  ===============================================
452  
-        ``instance``            An instance of the model where the 
  452
+        ``instance``            An instance of the model where the
453 453
                                 ``FileField`` is defined. More specifically,
454 454
                                 this is the particular instance where the
455 455
                                 current file is being attached.
456  
-                                
  456
+
457 457
                                 In most cases, this object will not have been
458 458
                                 saved to the database yet, so if it uses the
459 459
                                 default ``AutoField``, *it might not yet have a
460 460
                                 value for its primary key field*.
461  
-    
462  
-        ``filename``            The filename that was originally given to the 
  461
+
  462
+        ``filename``            The filename that was originally given to the
463 463
                                 file. This may or may not be taken into account
464 464
                                 when determining the final destination path.
465 465
         ======================  ===============================================
466  
-    
  466
+
467 467
 Also has one optional argument:
468 468
 
469 469
 .. attribute:: FileField.storage
470 470
 
471 471
     .. versionadded:: 1.0
472  
-    
  472
+
473 473
     Optional. A storage object, which handles the storage and retrieval of your
474 474
     files. See :ref:`topics-files` for details on how to provide this object.
475 475
 
@@ -486,14 +486,14 @@ takes a few steps:
486 486
        that this directory is writable by the Web server's user account.
487 487
 
488 488
     2. Add the :class:`FileField` or :class:`ImageField` to your model, making
489  
-       sure to define the :attr:`~FileField.upload_to` option to tell Django 
  489
+       sure to define the :attr:`~FileField.upload_to` option to tell Django
490 490
        to which subdirectory of :setting:`MEDIA_ROOT` it should upload files.
491 491
 
492 492
     3. All that will be stored in your database is a path to the file
493 493
        (relative to :setting:`MEDIA_ROOT`). You'll most likely want to use the
494  
-       convenience :attr:`~django.core.files.File.url` function provided by 
495  
-       Django. For example, if your :class:`ImageField` is called ``mug_shot``, 
496  
-       you can get the absolute URL to your image in a template with 
  494
+       convenience :attr:`~django.core.files.File.url` function provided by
  495
+       Django. For example, if your :class:`ImageField` is called ``mug_shot``,
  496
+       you can get the absolute URL to your image in a template with
497 497
        ``{{ object.mug_shot.url }}``.
498 498
 
499 499
 For example, say your :setting:`MEDIA_ROOT` is set to ``'/home/media'``, and
@@ -504,7 +504,7 @@ day. If you upload a file on Jan. 15, 2007, it will be saved in the directory
504 504
 ``/home/media/photos/2007/01/15``.
505 505
 
506 506
 If you want to retrieve the upload file's on-disk filename, or a URL that refers
507  
-to that file, or the file's size, you can use the 
  507
+to that file, or the file's size, you can use the
508 508
 :attr:`~django.core.files.File.name`, :attr:`~django.core.files.File.url`
509 509
 and :attr:`~django.core.files.File.size` attributes; see :ref:`topics-files`.
510 510
 
@@ -547,7 +547,7 @@ directory on the filesystem. Has three special arguments, of which the first is
547 547
     match a file called ``foo23.txt`` but not ``bar.txt`` or ``foo23.gif``.
548 548
 
549 549
 .. attribute:: FilePathField.recursive
550  
-    
  550
+
551 551
     Optional. Either ``True`` or ``False``. Default is ``False``. Specifies
552 552
     whether all subdirectories of :attr:`~FilePathField.path` should be included
553 553
 
@@ -597,7 +597,7 @@ image. Has two extra optional arguments:
597 597
 
598 598
     Name of a model field which will be auto-populated with the width of the
599 599
     image each time the model instance is saved.
600  
-    
  600
+
601 601
 In addition to the special attributes that are available for :class:`FileField`,
602 602
 an :class:`ImageField` also has ``File.height`` and ``File.width`` attributes.
603 603
 See :ref:`topics-files`.
@@ -739,7 +739,7 @@ Relationship fields
739 739
 
740 740
 .. module:: django.db.models.fields.related
741 741
    :synopsis: Related field types
742  
-   
  742
+
743 743
 .. currentmodule:: django.db.models
744 744
 
745 745
 Django also defines a set of fields that represent relations.
@@ -752,7 +752,7 @@ Django also defines a set of fields that represent relations.
752 752
 .. class:: ForeignKey(othermodel, [**options])
753 753
 
754 754
 A many-to-one relationship. Requires a positional argument: the class to which
755  
-the model is related. 
  755
+the model is related.
756 756
 
757 757
 .. _recursive-relationships:
758 758
 
@@ -809,13 +809,13 @@ define the details of how the relation works.
809 809
 
810 810
     only allows the choice of related objects with a ``pub_date`` before the
811 811
     current date/time to be chosen.
812  
-     
  812
+
813 813
     Instead of a dictionary this can also be a :class:`~django.db.models.Q`
814 814
     object (an object with a :meth:`get_sql` method) for more complex queries.
815  
-   
  815
+
816 816
     ``limit_choices_to`` has no effect on the inline FormSets that are created
817 817
     to display related objects in the admin.
818  
-   
  818
+
819 819
 .. attribute:: ForeignKey.related_name
820 820
 
821 821
     The name to use for the relation from the related object back to this one.
@@ -859,11 +859,11 @@ that control how the relationship functions.
859 859
 .. attribute:: ManyToManyField.related_name
860 860
 
861 861
     Same as :attr:`ForeignKey.related_name`.
862  
-    
  862
+
863 863
 .. attribute:: ManyToManyFields.limit_choices_to
864 864
 
865 865
     Same as :attr:`ForeignKey.limit_choices_to`.
866  
-    
  866
+
867 867
     ``limit_choices_to`` has no effect when used on a ``ManyToManyField`` with
868 868
     an intermediate table.
869 869
 
@@ -874,26 +874,26 @@ that control how the relationship functions.
874 874
 
875 875
         class Person(models.Model):
876 876
             friends = models.ManyToManyField("self")
877  
-         
  877
+
878 878
     When Django processes this model, it identifies that it has a
879 879
     :class:`ManyToManyField` on itself, and as a result, it doesn't add a
880 880
     ``person_set`` attribute to the ``Person`` class. Instead, the
881 881
     :class:`ManyToManyField` is assumed to be symmetrical -- that is, if I am
882 882
     your friend, then you are my friend.
883  
-    
  883
+
884 884
     If you do not want symmetry in many-to-many relationships with ``self``, set
885 885
     :attr:`~ManyToManyField.symmetrical` to ``False``. This will force Django to
886 886
     add the descriptor for the reverse relationship, allowing
887 887
     :class:`ManyToManyField` relationships to be non-symmetrical.
888  
-    
  888
+
889 889
 .. attribute:: ManyToManyFields.through
890 890
 
891  
-    Django will automatically generate a table to manage many-to-many 
  891
+    Django will automatically generate a table to manage many-to-many
892 892
     relationships. However, if you want to manually specify the intermediary
893 893
     table, you can use the :attr:`~ManyToManyField.through` option to specify
894 894
     the Django model that represents the intermediate table that you want to
895 895
     use.
896  
-    
  896
+
897 897
     The most common use for this option is when you want to associate
898 898
     :ref:`extra data with a many-to-many relationship <intermediary-manytomany>`.
899 899
 

0 notes on commit a50a188

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