mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
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:
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user