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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user