Changeset 3030
- Timestamp:
- 05/31/06 14:10:43 (2 years ago)
- Files:
-
- django/trunk/tests/modeltests/custom_methods/models.py (modified) (1 diff)
- django/trunk/tests/modeltests/m2m_and_m2o/models.py (modified) (2 diffs)
- django/trunk/tests/modeltests/pagination/models.py (modified) (5 diffs)
- django/trunk/tests/modeltests/transactions/models.py (modified) (1 diff)
- django/trunk/tests/modeltests/validation/models.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/modeltests/custom_methods/models.py
r2809 r3030 1 1 """ 2 3. Giving models custom methods and custom managers2 3. Giving models custom methods 3 3 4 4 Any method you add to a model will be available to instances. django/trunk/tests/modeltests/m2m_and_m2o/models.py
r2809 r3030 1 1 """ 2 27. Many-to-many and many-to-one relationships to the same table .2 27. Many-to-many and many-to-one relationships to the same table 3 3 4 4 This is a response to bug #1535 … … 17 17 def __repr__(self): 18 18 return "<Issue %d>" % (self.num,) 19 19 20 20 class Meta: 21 21 ordering = ('num',) django/trunk/tests/modeltests/pagination/models.py
r2809 r3030 1 1 """ 2 2 0. Object Pagination2 28. Object pagination 3 3 4 Django provides a framework for paginating a list of objects in a few. 5 This is often useful for dividing search results or long lists of objects 6 in to easily readable pages. 4 Django provides a framework for paginating a list of objects in a few lines 5 of code. This is often useful for dividing search results or long lists of 6 objects into easily readable pages. 7 """ 7 8 8 9 """10 9 from django.db import models 11 10 … … 13 12 headline = models.CharField(maxlength=100, default='Default headline') 14 13 pub_date = models.DateTimeField() 15 14 16 15 def __repr__(self): 17 return self.headline 18 16 return self.headline 17 19 18 API_TESTS = """ 20 19 # prepare a list of objects for pagination … … 35 34 2 36 35 37 # get the first page (zero-based) 38 >>> paginator.get_page(0) 36 # get the first page (zero-based) 37 >>> paginator.get_page(0) 39 38 [Article 1, Article 2, Article 3, Article 4, Article 5] 40 39 … … 46 45 >>> paginator.has_next_page(0) 47 46 True 48 47 49 48 >>> paginator.has_previous_page(0) 50 49 False … … 56 55 >>> paginator.has_previous_page(1) 57 56 True 58 57 59 58 """ django/trunk/tests/modeltests/transactions/models.py
r2809 r3030 1 1 """ 2 XXX. Transactions2 15. Transactions 3 3 4 4 Django handles transactions in three different ways. The default is to commit django/trunk/tests/modeltests/validation/models.py
r2809 r3030 1 1 """ 2 XX. Validation 2 29. Validation 3 4 This is an experimental feature! 3 5 4 6 Each model instance has a validate() method that returns a dictionary of
