mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-17 04:10:24 +00:00
Tweaked docs for get_subclass, added changelog entry.
This commit is contained in:
parent
4e361a20f8
commit
4de673ad21
2 changed files with 7 additions and 4 deletions
|
|
@ -4,6 +4,8 @@ CHANGES
|
|||
tip (unreleased)
|
||||
----------------
|
||||
|
||||
- Added ``InheritanceManager.get_subclass()``. Thanks smacker.
|
||||
|
||||
1.0.0 (2011.06.16)
|
||||
------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue