Code

Ticket #1375: model-api.diff

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

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

Line 
1Index: model-api.txt
2===================================================================
3--- model-api.txt       (revision 2360)
4+++ model-api.txt       (working copy)
5@@ -170,6 +170,14 @@
6     ``primary_key=True`` implies ``blank=False``, ``null=False`` and
7     ``unique=True``. Only one primary key is allowed on an object.
8 
9+    .. note::
10+       The primary key value is used to construct the (relative) URL for
11+       editing the object in the admin interface. If you primary key turns
12+       out to be a well-formed URL (such as ``http://....`` or
13+       ``mailto:...``), this can lead to not being able to edit the object.
14+       So do not set ``primary_key = True`` on fields that can take fully
15+       qualified URLs as values.
16+
17 ``radio_admin``
18     By default, Django's admin uses a select-box interface (<select>) for
19     fields that are ``ForeignKey`` or have ``choices`` set. If ``radio_admin``