diff --git a/README.rst b/README.rst index 4abe95f..7f25b87 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,14 @@ Polymorphic Models for Django ============================= +Django-polymorphic simplifies using inherited models in Django projects. +When a query is made at the base model, the inherited model classes are returned! + What is django_polymorphic good for? ------------------------------------ -Let's assume the models ``ArtProject`` and ``ResearchProject`` are derived -from the model ``Project``, and stored in the database: +Let's take the models ``ArtProject`` and ``ResearchProject`` which inherit +from the model ``Project``, and store them in the database: >>> Project.objects.create(topic="Department Party") >>> ArtProject.objects.create(topic="Painting with Tim", artist="T. Turner") @@ -37,12 +40,12 @@ Features * ORM integration: * support for ForeignKey, ManyToManyField, OneToOneField descriptors. - * Filtering/ordering of derived models (``ArtProject___artist``). + * Filtering/ordering of inherited models (``ArtProject___artist``). * Filtering model types: ``instance_of(...)`` and ``not_instance_of(...)`` * Combining querysets of different models (``qs3 = qs1 | qs2``) * Support for custom user-defined managers. -* Uses the minumum amount of queries needed to fetch the derived models. +* Uses the minumum amount of queries needed to fetch the inherited models. * Disabling polymorphic behavior when needed. While *django-polymorphic* makes subclassed models easy to use in Django, diff --git a/docs/advanced.rst b/docs/advanced.rst index 4a652e8..2d24159 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -32,8 +32,8 @@ You can also use this feature in Q-objects (with the same result as above): >>> ModelA.objects.filter( Q(instance_of=ModelB) ) -Polymorphic filtering (for fields in derived classes) ------------------------------------------------------ +Polymorphic filtering (for fields in inherited classes) +------------------------------------------------------- For example, cherrypicking objects from multiple derived classes anywhere in the inheritance tree, using Q objects (with the @@ -151,7 +151,7 @@ About Queryset Methods the base class, but this should never make a difference. * ``select_related()`` works just as usual, but it can not (yet) be used - to select relations in derived models + to select relations in inherited models (like ``ModelA.objects.select_related('ModelC___fieldxy')`` ) * ``extra()`` works as expected (it returns polymorphic results) but diff --git a/docs/changelog_archive.rst b/docs/changelog_archive.rst index c491e39..994da58 100644 --- a/docs/changelog_archive.rst +++ b/docs/changelog_archive.rst @@ -81,7 +81,7 @@ Bugfixes ~~~~~~~~ * Custom fields could cause problems when used as the primary key. - In derived models, Django's automatic ".pk" field does not always work + In inherited models, Django's automatic ".pk" field does not always work correctly for such custom fields: "some_object.pk" and "some_object.id" return different results (which they shouldn't, as pk should always be just an alias for the primary key field). It's unclear yet if the problem lies in diff --git a/docs/index.rst b/docs/index.rst index fbd9a97..f1fe11a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ Welcome to django-polymorphic's documentation! Django-polymorphic simplifies using inherited models in Django projects. When a query is made at the base model, the inherited model classes are returned. -When we store models that derive from a ``Project`` model... +When we store models that inherit from a ``Project`` model... >>> Project.objects.create(topic="Department Party") >>> ArtProject.objects.create(topic="Painting with Tim", artist="T. Turner") @@ -32,12 +32,12 @@ Features * support for ForeignKey, ManyToManyField, OneToOneField descriptors. * support for proxy models - * Filtering/ordering of derived models (``ArtProject___artist``). + * Filtering/ordering of inherited models (``ArtProject___artist``). * Filtering model types: ``instance_of(...)`` and ``not_instance_of(...)`` * Combining querysets of different models (``qs3 = qs1 | qs2``) * Support for custom user-defined managers. -* Uses the minumum amount of queries needed to fetch the derived models. +* Uses the minumum amount of queries needed to fetch the inherited models. * Disabling polymorphic behavior when needed.