Ticket #1375: model-api.diff

File model-api.diff, 874 bytes (added by Malcolm Tredinnick <malcolm@…>, 12 years ago)

Point out potential problem in use of primary_key attribute on fields.

  • model-api.txt

    170170    ``primary_key=True`` implies ``blank=False``, ``null=False`` and
    171171    ``unique=True``. Only one primary key is allowed on an object.
     173    .. note::
     174        The primary key value is used to construct the (relative) URL for
     175        editing the object in the admin interface. If you primary key turns
     176        out to be a well-formed URL (such as ``http://....`` or
     177        ``mailto:...``), this can lead to not being able to edit the object.
     178        So do not set ``primary_key = True`` on fields that can take fully
     179        qualified URLs as values.
    174182    By default, Django's admin uses a select-box interface (<select>) for
    175183    fields that are ``ForeignKey`` or have ``choices`` set. If ``radio_admin``
Back to Top