mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-15 02:33:13 +00:00
Don't set redirect.site on create. Ref #1461
This commit is contained in:
parent
c329f7e6b5
commit
dc6cdd2ba2
2 changed files with 2 additions and 3 deletions
|
|
@ -119,6 +119,7 @@ class TestRedirectsAddView(TestCase, WagtailTestUtils):
|
|||
redirects = models.Redirect.objects.filter(old_path='/test')
|
||||
self.assertEqual(redirects.count(), 1)
|
||||
self.assertEqual(redirects.first().redirect_link, 'http://www.test.com/')
|
||||
self.assertEqual(redirects.first().site, None)
|
||||
|
||||
def test_add_validation_error(self):
|
||||
response = self.post({
|
||||
|
|
|
|||
|
|
@ -108,9 +108,7 @@ def add(request):
|
|||
if request.POST:
|
||||
form = form_class(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
theredirect = form.save(commit=False)
|
||||
theredirect.site = request.site
|
||||
theredirect.save()
|
||||
theredirect = form.save()
|
||||
|
||||
messages.success(request, _("Redirect '{0}' added.").format(theredirect.title), buttons=[
|
||||
messages.button(reverse('wagtailredirects_edit_redirect', args=(theredirect.id,)), _('Edit'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue