diff --git a/django/views/generic/base.py b/django/views/generic/base.py
index 6dfbc7a..fcdc7c7 100644
a
|
b
|
class RedirectView(View):
|
139 | 139 | are provided as kwargs to this method. |
140 | 140 | """ |
141 | 141 | if self.url: |
| 142 | url = self.url % kwargs |
142 | 143 | args = self.request.META.get('QUERY_STRING', '') |
143 | 144 | if args and self.query_string: |
144 | | url = "%s?%s" % (self.url, args) |
145 | | else: |
146 | | url = self.url |
147 | | return url % kwargs |
| 145 | url = "%s?%s" % (url, args) |
| 146 | return url |
148 | 147 | else: |
149 | 148 | return None |
150 | 149 | |
diff --git a/tests/regressiontests/generic_views/base.py b/tests/regressiontests/generic_views/base.py
index e7aeaf9..6528dc6 100644
a
|
b
|
class RedirectViewTest(unittest.TestCase):
|
283 | 283 | self.assertEqual(response.status_code, 301) |
284 | 284 | self.assertEqual(response['Location'], '/bar/?pork=spam') |
285 | 285 | |
| 286 | def test_include_urlencoded_args(self): |
| 287 | "GET arguments can be URL-encoded when included in the redirected URL" |
| 288 | response = RedirectView.as_view(url='/bar/', query_string=True)( |
| 289 | self.rf.get('/foo/?unicode=%E2%9C%93')) |
| 290 | self.assertEqual(response.status_code, 301) |
| 291 | self.assertEqual(response['Location'], '/bar/?unicode=%E2%9C%93') |
| 292 | |
286 | 293 | def test_parameter_substitution(self): |
287 | 294 | "Redirection URLs can be parameterized" |
288 | 295 | response = RedirectView.as_view(url='/bar/%(object_id)d/')(self.rf.get('/foo/42/'), object_id=42) |