Ticket #18637: trac#18637.diff

File trac#18637.diff, 13.9 KB (added by stumbles, 3 years ago)

Replace usage of 'admin' as a synonym for ModelForms.

  • docs/ref/models/fields.txt

    diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
    index a43163c..d113034 100644
    a b If ``True``, the field is allowed to be blank. Default is ``False``. 
    7070
    7171Note that this is different than :attr:`~Field.null`. :attr:`~Field.null` is
    7272purely database-related, whereas :attr:`~Field.blank` is validation-related. If
    73 a field has ``blank=True``, validation on Django's admin site will allow entry
    74 of an empty value. If a field has ``blank=False``, the field will be required.
     73a field has ``blank=True``, validation will allow entry of an empty value. If a
     74field has ``blank=False``, the field will be required.
    7575
    7676.. _field-choices:
    7777
    of an empty value. If a field has ``blank=False``, the field will be required. 
    8181.. attribute:: Field.choices
    8282
    8383An iterable (e.g., a list or tuple) of 2-tuples to use as choices for this
    84 field.
     84field. If this is given, the default form widget will be a select box instead
     85of the standard text field and will limit choices to the choices given.
    8586
    86 If this is given, Django's admin will use a select box instead of the standard
    87 text field and will limit choices to the choices given.
    88 
    89 A choices list is an iterable of 2-tuples; the first element in each
    90 tuple is the actual value to be stored, and the second element is the
    91 human-readable name. For example::
     87The first element in each tuple is the actual value to be stored, and the
     88second element is the human-readable name. For example::
    9289
    9390    YEAR_IN_SCHOOL_CHOICES = (
    9491        ('FR', 'Freshman'),
    callable it will be called every time a new object is created. 
    203200
    204201.. attribute:: Field.editable
    205202
    206 If ``False``, the field will not be editable in the admin or via forms
    207 automatically generated from the model class. Default is ``True``.
     203If ``False``, the field will not be displayed in the admin or other
     204automatically generated forms. Default is ``True``.
    208205
    209206``error_messages``
    210207------------------
    the `Field types`_ section below. 
    224221
    225222.. attribute:: Field.help_text
    226223
    227 Extra "help" text to be displayed under the field on the object's admin form.
    228 It's useful for documentation even if your object doesn't have an admin form.
     224Extra "help" text to be displayed with the form widget. It's useful for
     225documentation even if your field isn't used on a form.
    229226
    230 Note that this value is *not* HTML-escaped when it's displayed in the admin
    231 interface. This lets you include HTML in :attr:`~Field.help_text` if you so
     227Note that this value is *not* HTML-escaped in automatically-generated
     228forms. This lets you include HTML in :attr:`~Field.help_text` if you so
    232229desire. For example::
    233230
    234231    help_text="Please use the following format: <em>YYYY-MM-DD</em>."
    Only one primary key is allowed on an object. 
    259256
    260257If ``True``, this field must be unique throughout the table.
    261258
    262 This is enforced at the database level and at the Django admin-form level. If
     259This is enforced at the database level and by model validation. If
    263260you try to save a model with a duplicate value in a :attr:`~Field.unique`
    264261field, a :exc:`django.db.IntegrityError` will be raised by the model's
    265262:meth:`~django.db.models.Model.save` method.
    For example, if you have a field ``title`` that has 
    279276``unique_for_date="pub_date"``, then Django wouldn't allow the entry of two
    280277records with the same ``title`` and ``pub_date``.
    281278
    282 This is enforced at the Django admin-form level but not at the database level.
     279This is enforced by model validation but not at the database level.
    283280
    284281``unique_for_month``
    285282--------------------
    otherwise. See :ref:`automatic-primary-key-fields`. 
    337334
    338335A 64 bit integer, much like an :class:`IntegerField` except that it is
    339336guaranteed to fit numbers from -9223372036854775808 to 9223372036854775807. The
    340 admin represents this as an ``<input type="text">`` (a single-line input).
     337default form widget for this field is a
     338:class:`~django.forms.widgets.TextInput`.
    341339
    342340
    343341``BooleanField``
    admin represents this as an ``<input type="text">`` (a single-line input). 
    347345
    348346A true/false field.
    349347
    350 The admin represents this as a checkbox.
     348The default form widget for this field is a
     349:class:`~django.forms.widgets.CheckboxInput`.
    351350
    352351If you need to accept :attr:`~Field.null` values then use
    353352:class:`NullBooleanField` instead.
    A string field, for small- to large-sized strings. 
    361360
    362361For large amounts of text, use :class:`~django.db.models.TextField`.
    363362
    364 The admin represents this as an ``<input type="text">`` (a single-line input).
     363The default form widget for this field is a
     364:class:`~django.forms.widgets.TextInput`.
    365365
    366366:class:`CharField` has one extra required argument:
    367367
    optional arguments: 
    414414    for creation of timestamps. Note that the current date is *always* used;
    415415    it's not just a default value that you can override.
    416416
    417 The admin represents this as an ``<input type="text">`` with a JavaScript
    418 calendar, and a shortcut for "Today". Includes an additional ``invalid_date``
    419 error message key.
     417The default form widget for this field is a
     418:class:`~django.forms.widgets.TextInput`. The admin adds a JavaScript calendar,
     419and a shortcut for "Today". Includes an additional ``invalid_date`` error
     420message key.
    420421
    421422.. note::
    422423    As currently implemented, setting ``auto_now`` or ``auto_now_add`` to
    error message key. 
    431432A date and time, represented in Python by a ``datetime.datetime`` instance.
    432433Takes the same extra arguments as :class:`DateField`.
    433434
    434 The admin represents this as two ``<input type="text">`` fields, with
    435 JavaScript shortcuts.
     435The default form widget for this field is a single
     436:class:`~django.forms.widgets.TextInput`. The admin uses two separate
     437:class:`~django.forms.widgets.TextInput` widgets with JavaScript shortcuts.
    436438
    437439``DecimalField``
    438440----------------
    decimal places:: 
    461463
    462464    models.DecimalField(..., max_digits=19, decimal_places=10)
    463465
    464 The admin represents this as an ``<input type="text">`` (a single-line input).
     466The default form widget for this field is a
     467:class:`~django.forms.widgets.TextInput`.
    465468
    466469.. note::
    467470
    Also has one optional argument: 
    539542    Optional. A storage object, which handles the storage and retrieval of your
    540543    files. See :doc:`/topics/files` for details on how to provide this object.
    541544
    542 The admin represents this field as an ``<input type="file">`` (a file-upload
    543 widget).
     545The default form widget for this field is a
     546:class:`~django.forms.widgets.FileInput`.
    544547
    545548Using a :class:`FileField` or an :class:`ImageField` (see below) in a model
    546549takes a few steps:
    can change the maximum length using the :attr:`~CharField.max_length` argument. 
    725728
    726729A floating-point number represented in Python by a ``float`` instance.
    727730
    728 The admin represents this as an ``<input type="text">`` (a single-line input).
     731The default form widget for this field is a
     732:class:`~django.forms.widgets.TextInput`.
    729733
    730734.. _floatfield_vs_decimalfield:
    731735
    length using the :attr:`~CharField.max_length` argument. 
    776780
    777781.. class:: IntegerField([**options])
    778782
    779 An integer. The admin represents this as an ``<input type="text">`` (a
    780 single-line input).
     783An integer. The default form widget for this field is a
     784:class:`~django.forms.widgets.TextInput`.
    781785
    782786``IPAddressField``
    783787------------------
    784788
    785789.. class:: IPAddressField([**options])
    786790
    787 An IP address, in string format (e.g. "192.0.2.30"). The admin represents this
    788 as an ``<input type="text">`` (a single-line input).
     791An IP address, in string format (e.g. "192.0.2.30"). The default form widget
     792for this field is a :class:`~django.forms.widgets.TextInput`.
    789793
    790794``GenericIPAddressField``
    791795-------------------------
    as an ``<input type="text">`` (a single-line input). 
    795799.. versionadded:: 1.4
    796800
    797801An IPv4 or IPv6 address, in string format (e.g. ``192.0.2.30`` or
    798 ``2a02:42fe::4``). The admin represents this as an ``<input type="text">``
    799 (a single-line input).
     802``2a02:42fe::4``). The default form widget for this field is a
     803:class:`~django.forms.widgets.TextInput`.
    800804
    801805The IPv6 address normalization follows :rfc:`4291#section-2.2` section 2.2,
    802806including using the IPv4 format suggested in paragraph 3 of that section, like
    are converted to lowercase. 
    823827.. class:: NullBooleanField([**options])
    824828
    825829Like a :class:`BooleanField`, but allows ``NULL`` as one of the options. Use
    826 this instead of a :class:`BooleanField` with ``null=True``. The admin represents
    827 this as a ``<select>`` box with "Unknown", "Yes" and "No" choices.
     830this instead of a :class:`BooleanField` with ``null=True``. The default form
     831widget for this field is a :class:`~django.forms.NullBooleanSelect`.
    828832
    829833``PositiveIntegerField``
    830834------------------------
    Like an :class:`IntegerField`, but only allows values under a certain 
    875879
    876880.. class:: TextField([**options])
    877881
    878 A large text field. The admin represents this as a ``<textarea>`` (a multi-line
    879 input).
     882A large text field. The default form widget for this field is a
     883:class:`~django.forms.Textarea`.
    880884
    881885.. admonition:: MySQL users
    882886
    input). 
    893897A time, represented in Python by a ``datetime.time`` instance. Accepts the same
    894898auto-population options as :class:`DateField`.
    895899
    896 The admin represents this as an ``<input type="text">`` with some JavaScript
     900The default form widget for this field is a
     901:class:`~django.forms.widgets.TextInput`. The admin adds some JavaScript
    897902shortcuts.
    898903
    899904``URLField``
    shortcuts. 
    903908
    904909A :class:`CharField` for a URL.
    905910
    906 The admin represents this as an ``<input type="text">`` (a single-line input).
     911The default form widget for this field is a
     912:class:`~django.forms.widgets.TextInput`.
    907913
    908914Like all :class:`CharField` subclasses, :class:`URLField` takes the optional
    909915:attr:`~CharField.max_length`argument. If you don't specify
    define the details of how the relation works. 
    979985.. attribute:: ForeignKey.limit_choices_to
    980986
    981987    A dictionary of lookup arguments and values (see :doc:`/topics/db/queries`)
    982     that limit the available admin choices for this object. Use this with
    983     functions from the Python ``datetime`` module to limit choices of objects by
    984     date. For example::
     988    that limit the available admin or ModelForm choices for this object. Use
     989    this with functions from the Python ``datetime`` module to limit choices of
     990    objects by date. For example::
    985991
    986992        limit_choices_to = {'pub_date__lte': datetime.now}
    987993
  • docs/topics/db/models.txt

    diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
    index ce15dc9..0567f7f 100644
    a b determine a few things: 
    108108
    109109* The database column type (e.g. ``INTEGER``, ``VARCHAR``).
    110110
    111 * The :doc:`widget </ref/forms/widgets>` to use in Django's admin interface,
    112   if you care to use it (e.g. ``<input type="text">``, ``<select>``).
     111* The default :doc:`widget </ref/forms/widgets>` to use when rendering a form
     112  field (e.g. ``<input type="text">``, ``<select>``).
    113113
    114114* The minimal validation requirements, used in Django's admin and in
    115115  automatically-generated forms.
    ones: 
    143143    Note that this is different than :attr:`~Field.null`.
    144144    :attr:`~Field.null` is purely database-related, whereas
    145145    :attr:`~Field.blank` is validation-related. If a field has
    146     :attr:`blank=True <Field.blank>`, validation on Django's admin site will
     146    :attr:`blank=True <Field.blank>`, validation will
    147147    allow entry of an empty value. If a field has :attr:`blank=False
    148148    <Field.blank>`, the field will be required.
    149149
    150150:attr:`~Field.choices`
    151151    An iterable (e.g., a list or tuple) of 2-tuples to use as choices for
    152     this field. If this is given, Django's admin will use a select box
     152    this field. If this is given, the default form widget will be a select box
    153153    instead of the standard text field and will limit choices to the choices
    154154    given.
    155155
    ones: 
    164164        )
    165165
    166166    The first element in each tuple is the value that will be stored in the
    167     database, the second element will be displayed by the admin interface,
     167    database, the second element will be displayed by the default form widget
    168168    or in a ModelChoiceField. Given an instance of a model object, the
    169169    display value for a choices field can be accessed using the
    170170    ``get_FOO_display`` method. For example::
    ones: 
    195195    created.
    196196
    197197:attr:`~Field.help_text`
    198     Extra "help" text to be displayed under the field on the object's admin
    199     form. It's useful for documentation even if your object doesn't have an
    200     admin form.
     198    Extra "help" text to be displayed with the form widget. It's useful for
     199    documentation even if your field isn't used on a form.
    201200
    202201:attr:`~Field.primary_key`
    203202    If ``True``, this field is the primary key for the model.
    It doesn't matter which model has the 
    360359:class:`~django.db.models.ManyToManyField`, but you should only put it in one
    361360of the models -- not both.
    362361
    363 Generally, :class:`~django.db.models.ManyToManyField` instances should go in the
    364 object that's going to be edited in the admin interface, if you're using
    365 Django's admin. In the above example, ``toppings`` is in ``Pizza`` (rather than
    366 ``Topping`` having a ``pizzas`` :class:`~django.db.models.ManyToManyField` )
    367 because it's more natural to think about a pizza having toppings than a
    368 topping being on multiple pizzas. The way it's set up above, the ``Pizza`` admin
    369 form would let users select the toppings.
     362Generally, :class:`~django.db.models.ManyToManyField` instances should go in
     363the object that's going to be edited on a form. In the above example,
     364``toppings`` is in ``Pizza`` (rather than ``Topping`` having a ``pizzas``
     365:class:`~django.db.models.ManyToManyField` ) because it's more natural to think
     366about a pizza having toppings than a topping being on multiple pizzas. The way
     367it's set up above, the ``Pizza`` form would let users select the toppings.
    370368
    371369.. seealso::
    372370
Back to Top