Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed interpolation of post_url_continue in the admin.

  • Loading branch information...
commit 02f3daadd6c4f4ae2ab4f37c6e4c523f438c205e 1 parent 59ddb79
@aaugustin aaugustin authored
View
10 django/contrib/admin/options.py
@@ -807,16 +807,6 @@ def response_add(self, request, obj, post_url_continue=None):
(opts.app_label, opts.module_name),
args=(pk_value,),
current_app=self.admin_site.name)
- else:
- try:
- post_url_continue = post_url_continue % pk_value
- warnings.warn(
- "The use of string formats for post_url_continue "
- "in ModelAdmin.response_add() is deprecated. Provide "
- "a pre-formatted url instead.",
- DeprecationWarning, stacklevel=2)
- except TypeError:
- pass
if "_popup" in request.POST:
post_url_continue += "?_popup=1"
return HttpResponseRedirect(post_url_continue)
View
12 tests/regressiontests/admin_custom_urls/models.py
@@ -71,18 +71,6 @@ def response_add(self, request, obj, post_url_continue=None):
request, obj, post_url_continue=reverse('admin:admin_custom_urls_car_history', args=[obj.pk]))
-class CarDeprecated(models.Model):
- """ This class must be removed in Django 1.6 """
- name = models.CharField(max_length=20)
-
-class CarDeprecatedAdmin(admin.ModelAdmin):
- """ This class must be removed in Django 1.6 """
- def response_add(self, request, obj, post_url_continue=None):
- return super(CarDeprecatedAdmin, self).response_add(
- request, obj, post_url_continue='../%s/history/')
-
-
admin.site.register(Action, ActionAdmin)
admin.site.register(Person, PersonAdmin)
admin.site.register(Car, CarAdmin)
-admin.site.register(CarDeprecated, CarDeprecatedAdmin)
View
20 tests/regressiontests/admin_custom_urls/tests.py
@@ -7,7 +7,7 @@
from django.test import TestCase
from django.test.utils import override_settings
-from .models import Action, Person, Car, CarDeprecated
+from .models import Action, Person, Car
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
@@ -122,21 +122,3 @@ def test_post_url_continue(self):
self.assertEqual(len(cars), 1)
self.assertRedirects(
response, reverse('admin:admin_custom_urls_car_history', args=[cars[0].pk]))
-
- def test_post_url_continue_string_formats(self):
- """
- Ensures that string formats are accepted for post_url_continue. This
- is a deprecated functionality that will be removed in Django 1.6 along
- with this test.
- """
- with warnings.catch_warnings(record=True) as w:
- post_data = { 'name': 'SuperFast', '_continue': '1' }
- self.assertEqual(Car.objects.count(), 0)
- response = self.client.post(
- reverse('admin:admin_custom_urls_cardeprecated_add'), post_data)
- cars = CarDeprecated.objects.all()
- self.assertEqual(len(cars), 1)
- self.assertRedirects(
- response, reverse('admin:admin_custom_urls_cardeprecated_history', args=[cars[0].pk]))
- self.assertEqual(len(w), 1)
- self.assertTrue(isinstance(w[0].message, DeprecationWarning))
Please sign in to comment.
Something went wrong with that request. Please try again.