Index: docs/ref/contrib/admin/index.txt
===================================================================
--- docs/ref/contrib/admin/index.txt	(revisión: 16341)
+++ docs/ref/contrib/admin/index.txt	(copia de trabajo)
@@ -696,6 +696,18 @@
     If this isn't provided, the Django admin will use the model's default
     ordering.
 
+    If you need to specify a dynamic order (for example depending on user or
+    language) you can implement a ``get_ordering`` method. This method take
+    ``request`` as parameter and returns the ordering list/tuple. For example::
+
+              class PersonAdmin(ModelAdmin):
+
+                  def get_ordering(self, request):
+                      if request.user.is_superuser:
+                          return ('rank', )
+                      else:
+                          return ('name', )
+
     .. versionchanged:: 1.4
 
     Django honors all elements in the list/tuple; before 1.4, only the first
Index: django/contrib/admin/options.py
===================================================================
--- django/contrib/admin/options.py	(revisión: 16341)
+++ django/contrib/admin/options.py	(copia de trabajo)
@@ -208,7 +208,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)
         if ordering:
             qs = qs.order_by(*ordering)
         return qs
@@ -260,6 +260,10 @@
             clean_lookup = LOOKUP_SEP.join(parts)
             return clean_lookup in self.list_filter or clean_lookup == self.date_hierarchy
 
+    def get_ordering(self, request):
+        return self.ordering or ()  # otherwise we might try to *None, which is bad ;)
+
+
 class ModelAdmin(BaseModelAdmin):
     "Encapsulates all admin options and functionality for a given model."
 
Index: django/contrib/admin/views/main.py
===================================================================
--- django/contrib/admin/views/main.py	(revisión: 16341)
+++ django/contrib/admin/views/main.py	(copia de trabajo)
@@ -76,7 +76,7 @@
             self.list_editable = ()
         else:
             self.list_editable = list_editable
-        self.ordering = self.get_ordering()
+        self.ordering = self.get_ordering(request)
         self.query = request.GET.get(SEARCH_VAR, '')
         self.query_set = self.get_query_set(request)
         self.get_results(request)
@@ -172,12 +172,13 @@
             ordering = self.lookup_opts.ordering
         return ordering
 
-    def get_ordering(self):
+    def get_ordering(self, request):
         params = self.params
-        # For ordering, first check the "ordering" parameter in the admin
+        # For ordering, first check the if exists the "get_ordering" method
+        # in model admin, then check "ordering" parameter in the admin
         # options, then check the object's default ordering. Finally, a
         # manually-specified ordering from the query string overrides anything.
-        ordering = self._get_default_ordering()
+        ordering = self.model_admin.get_ordering(request) or self._get_default_ordering()
 
         if ORDER_VAR in params:
             # Clear ordering and used params
Index: tests/regressiontests/admin_ordering/tests.py
===================================================================
--- tests/regressiontests/admin_ordering/tests.py	(revisión: 16341)
+++ tests/regressiontests/admin_ordering/tests.py	(copia de trabajo)
@@ -1,7 +1,8 @@
 from django.test import TestCase
+from django.contrib.auth.models import User
 from django.contrib.admin.options import ModelAdmin
 
-from models import Band, Song, SongInlineDefaultOrdering, SongInlineNewOrdering
+from models import Band, Song, SongInlineDefaultOrdering, SongInlineNewOrdering, DynOrderingBandAdmin
 
 class TestAdminOrdering(TestCase):
     """
@@ -38,6 +39,23 @@
         names = [b.name for b in ma.queryset(None)]
         self.assertEqual([u'Radiohead', u'Van Halen', u'Aerosmith'], names)
 
+    def test_dynamic_ordering(self):
+        """
+        Let's use a custom ModelAdmin that changes the ordering dinamically.
+        """
+        super_user = User.objects.create(username='admin', is_superuser=True)
+        other_user = User.objects.create(username='other')
+        class DummyRequest(object): pass
+        request = DummyRequest()
+        request.user = super_user
+        ma = DynOrderingBandAdmin(Band, None)
+        names = [b.name for b in ma.queryset(request)]
+        self.assertEqual([u'Radiohead', u'Van Halen', u'Aerosmith'], names)
+        request.user = other_user
+        names = [b.name for b in ma.queryset(request)]
+        self.assertEqual([u'Aerosmith', u'Radiohead', u'Van Halen'], names)
+
+
 class TestInlineModelAdminOrdering(TestCase):
     """
     Let's make sure that InlineModelAdmin.queryset uses the ordering we define
Index: tests/regressiontests/admin_ordering/models.py
===================================================================
--- tests/regressiontests/admin_ordering/models.py	(revisión: 16341)
+++ tests/regressiontests/admin_ordering/models.py	(copia de trabajo)
@@ -18,9 +18,19 @@
     class Meta:
         ordering = ('name',)
 
+class DynOrderingBandAdmin(admin.ModelAdmin):
+
+    def get_ordering(self, request):
+        if request.user.is_superuser:
+            return ('rank',)
+        else:
+            return ('name',)
+
 class SongInlineDefaultOrdering(admin.StackedInline):
     model = Song
 
 class SongInlineNewOrdering(admin.StackedInline):
     model = Song
     ordering = ('duration', )
+
+
