| 343 | If your object has a ``ManyToManyField``, you'll need to manually |
| 344 | update ``new_data`` with details of the related objects. Let's say |
| 345 | you're tagging your Places. In your model, that might looks like |
| 346 | this:: |
| 347 | |
| 348 | from django.models.tags import tags |
| 349 | |
| 350 | class Place(meta.Model): |
| 351 | # ... all the other fields |
| 352 | tags = ManyToManyField(tags.Tag, blank=True) |
| 353 | |
| 354 | Details of a ``ManyToManyField``, however, won't be present in the |
| 355 | ``__dict__`` of your instance; they're stored in a separate table |
| 356 | and fetched and manipulated with ``get_*_list``, ``get_*_count``, and |
| 357 | ``set_*`` methods on your object (see the |
| 358 | `Many-to-one relationship model example`_ for a full example). So, |
| 359 | you have to add a little more code to make these details available |
| 360 | to the ``ChangeManipulator``. Continuing our example from above, |
| 361 | all we need is one extra line in ``edit_place``:: |
| 362 | |
| 363 | # This makes sure the form accurate represents the fields of the place. |
| 364 | new_data = place.__dict__ |
| 365 | # ... and this handles the ManyToManyField for place's tags. |
| 366 | new_data['tags'] = [t.id for t in place.get_tag_list()] |
| 367 | |