1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Added further flexibility to ModelAdmin for controlling post-save redirections.

Refs #19505.
This commit is contained in:
Julien Phalip
2012-12-30 21:33:21 -08:00
parent f80a1934cd
commit cee40c7d79
3 changed files with 45 additions and 11 deletions

View File

@@ -56,10 +56,14 @@ class Person(models.Model):
class PersonAdmin(admin.ModelAdmin):
def response_post_save(self, request, obj):
def response_post_save_add(self, request, obj):
return HttpResponseRedirect(
reverse('admin:admin_custom_urls_person_history', args=[obj.pk]))
def response_post_save_change(self, request, obj):
return HttpResponseRedirect(
reverse('admin:admin_custom_urls_person_delete', args=[obj.pk]))
class Car(models.Model):
name = models.CharField(max_length=20)