Commit ec2baaaf authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Redirecting to mapping-edition when creating a new data source with a file

parent 130a626f
...@@ -821,7 +821,7 @@ class DataSourceCreateViewTestCase(ViewTestCase): ...@@ -821,7 +821,7 @@ class DataSourceCreateViewTestCase(ViewTestCase):
self.assertRedirects( self.assertRedirects(
response_4, response_4,
expected_url=reverse('viralhostrangedb:data-source-detail', args=[new_pk]) expected_url=reverse('viralhostrangedb:data-source-mapping-edit', args=[new_pk])
) )
def test_creation_with_a_live(self): def test_creation_with_a_live(self):
......
...@@ -1015,6 +1015,21 @@ class DataSourceWizard(wizard_views.NamedUrlSessionWizardView): ...@@ -1015,6 +1015,21 @@ class DataSourceWizard(wizard_views.NamedUrlSessionWizardView):
form_dict["Information"].save() form_dict["Information"].save()
if self.upload_data(): if self.upload_data():
form_dict["Upload"].save(importation_observer=MessageImportationObserver(request=self.request)) form_dict["Upload"].save(importation_observer=MessageImportationObserver(request=self.request))
url = reverse("viralhostrangedb:data-source-mapping-edit", args=[self.instance.pk])
messages.success(
request=self.request,
message=mark_safe(_(
"""Successfully imported data source """
"""<a href="%(url_data_source_name)s" target="_blank"><b>%(data_source_name)s</b></a>."""
"""Redirecting to <a href="%(url)s">%(url)s</a> to map the responses to the global scheme."""
) % dict(
data_source_name=self.instance.name,
url_data_source_name=self.instance.get_absolute_url(),
url=url,
)),
)
return HttpResponseRedirect(url)
else: else:
self.instance.save() self.instance.save()
form_dict["LiveInput"].save(data_source=self.instance) form_dict["LiveInput"].save(data_source=self.instance)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment