Fixed #12875 -- Added get_ordering to ModelAdmin. Many thanks to Manuel Saelices.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16383 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2011-06-12 13:04:53 +00:00
parent f0adae4c6e
commit f749bb829c
6 changed files with 69 additions and 12 deletions

View file

@ -24,3 +24,11 @@ class SongInlineDefaultOrdering(admin.StackedInline):
class SongInlineNewOrdering(admin.StackedInline):
model = Song
ordering = ('duration', )
class DynOrderingBandAdmin(admin.ModelAdmin):
def get_ordering(self, request):
if request.user.is_superuser:
return ['rank']
else:
return ['name']