800 | | if "_popup" in request.POST: |
801 | | post_url_continue += "?_popup=1" |
802 | | return HttpResponseRedirect(post_url_continue % pk_value) |
| 800 | if post_url_continue is None: |
| 801 | post_url_continue = reverse('admin:%s_%s_change' % |
| 802 | (opts.app_label, opts.module_name), |
| 803 | args=(pk_value,), |
| 804 | current_app=self.admin_site.name) |
| 805 | if "_popup" in request.POST: |
| 806 | post_url_continue += "?_popup=1" |
| 807 | return HttpResponseRedirect(post_url_continue) |
815 | | |
816 | | # Figure out where to redirect. If the user has change permission, |
817 | | # redirect to the change-list page for this object. Otherwise, |
818 | | # redirect to the admin index. |
819 | | if self.has_change_permission(request, None): |
820 | | post_url = reverse('admin:%s_%s_changelist' % |
821 | | (opts.app_label, opts.module_name), |
822 | | current_app=self.admin_site.name) |
823 | | else: |
824 | | post_url = reverse('admin:index', |
825 | | current_app=self.admin_site.name) |
826 | | return HttpResponseRedirect(post_url) |
| 820 | return self.response_post_save(request, obj) |
866 | | # Figure out where to redirect. If the user has change permission, |
867 | | # redirect to the change-list page for this object. Otherwise, |
868 | | # redirect to the admin index. |
869 | | if self.has_change_permission(request, None): |
870 | | post_url = reverse('admin:%s_%s_changelist' % |
871 | | (opts.app_label, module_name), |
872 | | current_app=self.admin_site.name) |
873 | | else: |
874 | | post_url = reverse('admin:index', |
875 | | current_app=self.admin_site.name) |
876 | | return HttpResponseRedirect(post_url) |
| 860 | return self.response_post_save(request, obj) |
| 861 | |
| 862 | def response_post_save(self, request, obj): |
| 863 | """ |
| 864 | Figure out where to redirect after the 'Save' button has been pressed. |
| 865 | If the user has change permission, redirect to the change-list page for |
| 866 | this object. Otherwise, redirect to the admin index. |
| 867 | """ |
| 868 | opts = obj._meta |
| 869 | if obj._deferred: |
| 870 | opts_ = opts.proxy_for_model._meta |
| 871 | module_name = opts_.module_name |
| 872 | else: |
| 873 | module_name = opts.module_name |
| 874 | if self.has_change_permission(request, None): |
| 875 | post_url = reverse('admin:%s_%s_changelist' % |
| 876 | (opts.app_label, module_name), |
| 877 | current_app=self.admin_site.name) |
| 878 | else: |
| 879 | post_url = reverse('admin:index', |
| 880 | current_app=self.admin_site.name) |
| 881 | return HttpResponseRedirect(post_url) |