diff --git a/django/db/models/base.py b/django/db/models/base.py
index 5f05865..80422ee 100644
a
|
b
|
class Model(six.with_metaclass(ModelBase)):
|
666 | 666 | |
667 | 667 | delete.alters_data = True |
668 | 668 | |
| 669 | def _get_manager_or_default(self, attr=None): |
| 670 | if attr and hasattr(self.__class__, attr): |
| 671 | manager = getattr(self.__class__, attr) |
| 672 | else: |
| 673 | manager = self.__class__._default_manager |
| 674 | return manager |
| 675 | |
669 | 676 | def _get_FIELD_display(self, field): |
670 | 677 | value = getattr(self, field.attname) |
671 | 678 | return force_text(dict(field.flatchoices).get(value, value), strings_only=True) |
… |
… |
class Model(six.with_metaclass(ModelBase)):
|
675 | 682 | raise ValueError("get_next/get_previous cannot be used on unsaved objects.") |
676 | 683 | op = is_next and 'gt' or 'lt' |
677 | 684 | order = not is_next and '-' or '' |
| 685 | using_manager = kwargs.pop('using_manager', None) |
| 686 | manager = self._get_manager_or_default(using_manager) |
678 | 687 | param = force_text(getattr(self, field.attname)) |
679 | 688 | q = Q(**{'%s__%s' % (field.name, op): param}) |
680 | 689 | q = q | Q(**{field.name: param, 'pk__%s' % op: self.pk}) |
681 | | qs = self.__class__._default_manager.using(self._state.db).filter(**kwargs).filter(q).order_by('%s%s' % (order, field.name), '%spk' % order) |
| 690 | qs = manager.using(self._state.db).filter(**kwargs).filter(q).order_by('%s%s' % (order, field.name), '%spk' % order) |
682 | 691 | try: |
683 | 692 | return qs[0] |
684 | 693 | except IndexError: |