Index: django/contrib/admin/options.py
===================================================================
--- django/contrib/admin/options.py	(revisión: 12454)
+++ django/contrib/admin/options.py	(copia de trabajo)
@@ -261,6 +261,9 @@
         )
         return urlpatterns
 
+    def get_ordering(self, request):
+        return None
+
     def urls(self):
         return self.get_urls()
     urls = property(urls)
@@ -325,7 +328,7 @@
         """
         qs = self.model._default_manager.get_query_set()
         # TODO: this should be handled by some parameter to the ChangeList.
-        ordering = self.ordering or () # otherwise we might try to *None, which is bad ;)
+        ordering = self.get_ordering(request) or self.ordering or () # otherwise we might try to *None, which is bad ;)
         if ordering:
             qs = qs.order_by(*ordering)
         return qs
Index: django/contrib/admin/views/main.py
===================================================================
--- django/contrib/admin/views/main.py	(revisión: 12454)
+++ django/contrib/admin/views/main.py	(copia de trabajo)
@@ -63,7 +63,7 @@
         if ERROR_FLAG in self.params:
             del self.params[ERROR_FLAG]
 
-        self.order_field, self.order_type = self.get_ordering()
+        self.order_field, self.order_type = self.get_ordering(request)
         self.query = request.GET.get(SEARCH_VAR, '')
         self.query_set = self.get_query_set()
         self.get_results(request)
@@ -130,13 +130,14 @@
         self.multi_page = multi_page
         self.paginator = paginator
 
-    def get_ordering(self):
+    def get_ordering(self, request):
         lookup_opts, params = self.lookup_opts, self.params
-        # For ordering, first check the "ordering" parameter in the admin
+        # For ordering, first check if exists the "get_ordering" method
+        # in model admin, then check the "ordering" parameter in admin
         # options, then check the object's default ordering. If neither of
         # those exist, order descending by ID by default. Finally, look for
         # manually-specified ordering from the query string.
-        ordering = self.model_admin.ordering or lookup_opts.ordering or ['-' + lookup_opts.pk.name]
+        ordering = self.model_admin.get_ordering(request) or self.model_admin.ordering or lookup_opts.ordering or ['-' + lookup_opts.pk.name]
 
         if ordering[0].startswith('-'):
             order_field, order_type = ordering[0][1:], 'desc'
Index: tests/regressiontests/admin_ordering/models.py
===================================================================
--- tests/regressiontests/admin_ordering/models.py	(revisión: 12454)
+++ tests/regressiontests/admin_ordering/models.py	(copia de trabajo)
@@ -42,5 +42,31 @@
 >>> [b.name for b in ma.queryset(None)]
 [u'Radiohead', u'Van Halen', u'Aerosmith']
 
+
+Let's use a custom ModelAdmin that changes the ordering dinamically.
+
+>>> class DynOrderingBandAdmin(ModelAdmin):
+...     def get_ordering(self, request):
+...         if request.user.is_superuser:
+...             return ('rank',)
+...         else:
+...             return ('name',)
+
+>>> from django.contrib.auth.models import User
+>>> super_user = User.objects.create(username='admin', is_superuser=True)
+>>> other_user = User.objects.create(username='other')
+>>> class DummyRequest(object): pass
+>>> request = DummyRequest()
+
+Ordering will be different for a super user and a normal one
+
+>>> request.user = super_user
+>>> ma = DynOrderingBandAdmin(Band, None)
+>>> [b.name for b in ma.queryset(request)]
+[u'Radiohead', u'Van Halen', u'Aerosmith']
+>>> request.user = other_user
+>>> [b.name for b in ma.queryset(request)]
+[u'Aerosmith', u'Radiohead', u'Van Halen']
+
 """
 }
Index: tests/regressiontests/modeladmin/models.py
===================================================================
--- tests/regressiontests/modeladmin/models.py	(revisión: 12454)
+++ tests/regressiontests/modeladmin/models.py	(copia de trabajo)
@@ -8,7 +8,7 @@
     name = models.CharField(max_length=100)
     bio = models.TextField()
     sign_date = models.DateField()
-    
+
     def __unicode__(self):
         return self.name
 
@@ -147,7 +147,7 @@
 >>> from django import forms
 >>> class AdminBandForm(forms.ModelForm):
 ...     delete = forms.BooleanField()
-...     
+...
 ...     class Meta:
 ...         model = Band
 
