| | 1502 | Fields which handle relationships |
|---|
| | 1503 | --------------------------------- |
|---|
| | 1504 | |
|---|
| | 1505 | For representing relationships between models, two fields are |
|---|
| | 1506 | provided which can derive their choices from a ``QuerySet``, and which |
|---|
| | 1507 | place one or more model objects into the ``cleaned_data`` dictionary |
|---|
| | 1508 | of forms in which they're used. Both of these fields have an |
|---|
| | 1509 | additional required argument: |
|---|
| | 1510 | |
|---|
| | 1511 | ``queryset`` |
|---|
| | 1512 | A ``QuerySet`` of model objects from which the choices for the |
|---|
| | 1513 | field will be derived, and which will be used to validate the |
|---|
| | 1514 | user's selection. |
|---|
| | 1515 | |
|---|
| | 1516 | ``ModelChoiceField`` |
|---|
| | 1517 | ~~~~~~~~~~~~~~~~~~~~ |
|---|
| | 1518 | |
|---|
| | 1519 | Allows the selection of a single model object, suitable for |
|---|
| | 1520 | representing a foreign key. |
|---|
| | 1521 | |
|---|
| | 1522 | ``ModelMultipleChoiceField`` |
|---|
| | 1523 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| | 1524 | |
|---|
| | 1525 | Allows the selection of one or more model objects, suitable for |
|---|
| | 1526 | representing a many-to-many relation. |
|---|
| | 1527 | |
|---|
| | 1528 | |
|---|