Changeset 2747
- Timestamp:
- 04/24/06 21:22:16 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/tests/modeltests/custom_managers/models.py
r2205 r2747 31 31 is_published = models.BooleanField() 32 32 published_objects = PublishedBookManager() 33 authors = models.ManyToManyField(Person, related_name='books') 33 34 34 35 def __repr__(self): … … 59 60 [Bugs Bunny] 60 61 62 # The RelatedManager used on the 'books' descriptor extends the default manager 63 >>> from modeltests.custom_managers.models import PublishedBookManager 64 >>> isinstance(p2.books, PublishedBookManager) 65 True 66 61 67 >>> b1 = Book(title='How to program', author='Rodney Dangerfield', is_published=True) 62 68 >>> b1.save() … … 70 76 ... 71 77 AttributeError: type object 'Book' has no attribute 'objects' 78 79 # The RelatedManager used on the 'authors' descriptor extends the default manager 80 >>> from modeltests.custom_managers.models import PersonManager 81 >>> isinstance(b2.authors, PersonManager) 82 True 72 83 73 84 >>> Book.published_objects.all()
