Django

Code

Ticket #1375: model-api.diff

File model-api.diff, 0.9 kB (added by Malcolm Tredinnick <malcolm@pointy-stick.com>, 3 years ago)

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

  • model-api.txt

    old new  
    170170    ``primary_key=True`` implies ``blank=False``, ``null=False`` and 
    171171    ``unique=True``. Only one primary key is allowed on an object. 
    172172 
     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. 
     180 
    173181``radio_admin`` 
    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``