Ticket #1342: django_1342.diff
File django_1342.diff, 2.0 KB (added by , 19 years ago) |
---|
-
django/db/models/options.py
196 196 class AdminOptions: 197 197 def __init__(self, fields=None, js=None, list_display=None, list_filter=None, 198 198 date_hierarchy=None, save_as=False, ordering=None, search_fields=None, 199 save_on_top=False, list_select_related=False, manager=None ):199 save_on_top=False, list_select_related=False, manager=None, list_limit=None): 200 200 self.fields = fields 201 201 self.js = js or [] 202 202 self.list_display = list_display or ['__str__'] 203 203 self.list_filter = list_filter or [] 204 self.list_limit = list_limit 204 205 self.date_hierarchy = date_hierarchy 205 206 self.save_as, self.ordering = save_as, ordering 206 207 self.search_fields = search_fields or [] -
django/contrib/admin/views/main.py
589 589 return '?' + '&'.join(['%s=%s' % (k, v) for k, v in p.items()]).replace(' ', '%20') 590 590 591 591 def get_results(self, request): 592 paginator = ObjectPaginator(self.query_set, DEFAULT_RESULTS_PER_PAGE) 592 results_per_page = self.lookup_opts.admin.list_limit 593 if results_per_page is None: 594 results_per_page = DEFAULT_RESULTS_PER_PAGE 595 paginator = ObjectPaginator(self.query_set, results_per_page) 593 596 594 597 # Get the number of objects, with admin filters applied. 595 598 try: … … 611 614 full_result_count = self.manager.count() 612 615 613 616 can_show_all = result_count <= MAX_SHOW_ALL_ALLOWED 614 multi_page = result_count > DEFAULT_RESULTS_PER_PAGE617 multi_page = result_count > results_per_page 615 618 616 619 # Get the list of objects to display on this page. 617 620 if (self.show_all and can_show_all) or not multi_page: