django-orchestra-test/orchestra/contrib/mailer/actions.py

9 lines
264 B
Python
Raw Permalink Normal View History

from django.core.urlresolvers import reverse
from django.shortcuts import redirect
def last(modeladmin, request, queryset):
last = queryset.model.objects.latest('id')
url = reverse('admin:mailer_message_change', args=(last.pk,))
return redirect(url)