Update documentation to reflect recent changes

fix_request_path_info
Hugo Osvaldo Barrera 2015-10-21 22:16:35 -03:00
parent c48d4f589b
commit d4f061de8b
3 changed files with 11 additions and 7 deletions

View File

@ -6,7 +6,7 @@ Advanced features
In the examples below, these models are being used::
from django.db import models
from polymorphic import PolymorphicModel
from polymorphic.models import PolymorphicModel
class ModelA(PolymorphicModel):
field1 = models.CharField(max_length=10)

View File

@ -10,7 +10,8 @@ manager class, just derive your manager from ``PolymorphicManager`` instead of
``models.Manager``. As with vanilla Django, in your model class, you should
explicitly add the default manager first, and then your custom manager::
from polymorphic import PolymorphicModel, PolymorphicManager
from polymorphic.models import PolymorphicModel
from polymorphic.manager import PolymorphicManager
class TimeOrderedManager(PolymorphicManager):
def get_queryset(self):
@ -41,7 +42,8 @@ base models, as long as these are polymorphic. This means that all
managers defined in polymorphic base models continue to work as
expected in models inheriting from this base model::
from polymorphic import PolymorphicModel, PolymorphicManager
from polymorphic.models import PolymorphicModel
from polymorphic.manager import PolymorphicManager
class TimeOrderedManager(PolymorphicManager):
def get_queryset(self):
@ -77,7 +79,9 @@ which is the queryset class the manager should use. Just as with vanilla Django,
you may define your own custom queryset classes. Just use PolymorphicQuerySet
instead of Django's QuerySet as the base class::
from polymorphic import PolymorphicModel, PolymorphicManager, PolymorphicQuerySet
from polymorphic.models import PolymorphicModel
from polymorphic.manager import PolymorphicManager
from polymorphic.query import PolymorphicQuerySet
class MyQuerySet(PolymorphicQuerySet):
def my_queryset_method(...):

View File

@ -19,7 +19,7 @@ Making Your Models Polymorphic
Use ``PolymorphicModel`` instead of Django's ``models.Model``, like so::
from polymorphic import PolymorphicModel
from polymorphic.models import PolymorphicModel
class Project(PolymorphicModel):
topic = models.CharField(max_length=30)