Tweaked docs for get_subclass, added changelog entry.

This commit is contained in:
Carl Meyer 2011-10-26 11:12:14 -06:00
parent 4e361a20f8
commit 4de673ad21
2 changed files with 7 additions and 4 deletions

View file

@ -4,6 +4,8 @@ CHANGES
tip (unreleased)
----------------
- Added ``InheritanceManager.get_subclass()``. Thanks smacker.
1.0.0 (2011.06.16)
------------------

View file

@ -263,14 +263,15 @@ be returned as their actual type, you can pass subclass names to
nearby_places = Place.objects.select_subclasses("restaurant")
# restaurants will be Restaurant instances, bars will still be Place instances
Also it provides syntax sugar for `get()` method::
``InheritanceManager`` also provides a subclass-fetching alternative to the
``get()`` method::
place = Place.objects.get_subclass(id=some_id)
# "place" will automatically be an instance of Place, Restaurant, or Bar
If you don't explicitly call ``select_subclasses()``, an ``InheritanceManager``
behaves identically to a normal ``Manager``; so it's safe to use as your
default manager for the model.
If you don't explicitly call ``select_subclasses()`` or ``get_subclass()``,
an ``InheritanceManager`` behaves identically to a normal ``Manager``; so
it's safe to use as your default manager for the model.
.. note::
``InheritanceManager`` currently only supports a single level of model