[TELE-513] use django 2.2 reverse import

This commit is contained in:
Daniel Muyshond 2021-05-25 17:24:57 +02:00
parent 53e2966274
commit 3786691343
1 changed files with 55 additions and 31 deletions

View File

@ -1,6 +1,6 @@
from django.views.generic import View, CreateView, DeleteView, UpdateView from django.views.generic import View, CreateView, DeleteView, UpdateView
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from django.core.urlresolvers import reverse from django.urls import reverse
from .models import ImioTs1Datasources, MotivationTerm, DestinationTerm from .models import ImioTs1Datasources, MotivationTerm, DestinationTerm
@ -11,65 +11,89 @@ class DatasourcesView(View, SingleObjectMixin):
class MotivationtermAddView(CreateView): class MotivationtermAddView(CreateView):
model = MotivationTerm model = MotivationTerm
fields = '__all__' fields = "__all__"
template_name = 'passerelle_imio_ts1_datasources/motivationterm_form.html' template_name = "passerelle_imio_ts1_datasources/motivationterm_form.html"
def get_success_url(self): def get_success_url(self):
connector = ImioTs1Datasources.objects.get(slug=self.kwargs['connector_slug']) connector = ImioTs1Datasources.objects.get(slug=self.kwargs["connector_slug"])
return reverse('view-connector', return reverse(
kwargs={'connector': connector.get_connector_slug(), "view-connector",
'slug': connector.slug}) kwargs={
"connector": connector.get_connector_slug(),
"slug": connector.slug,
},
)
class MotivationtermDeleteView(DeleteView): class MotivationtermDeleteView(DeleteView):
model = MotivationTerm model = MotivationTerm
def get_success_url(self): def get_success_url(self):
connector = ImioTs1Datasources.objects.get(slug=self.kwargs['connector_slug']) connector = ImioTs1Datasources.objects.get(slug=self.kwargs["connector_slug"])
return reverse('view-connector', return reverse(
kwargs={'connector': connector.get_connector_slug(), "view-connector",
'slug': connector.slug}) kwargs={
"connector": connector.get_connector_slug(),
"slug": connector.slug,
},
)
class MotivationtermUpdateView(UpdateView): class MotivationtermUpdateView(UpdateView):
model = MotivationTerm model = MotivationTerm
fields = '__all__' fields = "__all__"
def get_success_url(self): def get_success_url(self):
connector = ImioTs1Datasources.objects.get(slug=self.kwargs['connector_slug']) connector = ImioTs1Datasources.objects.get(slug=self.kwargs["connector_slug"])
return reverse('view-connector', return reverse(
kwargs={'connector': connector.get_connector_slug(), "view-connector",
'slug': connector.slug}) kwargs={
"connector": connector.get_connector_slug(),
"slug": connector.slug,
},
)
class DestinationtermAddView(CreateView): class DestinationtermAddView(CreateView):
model = DestinationTerm model = DestinationTerm
fields = '__all__' fields = "__all__"
template_name = 'passerelle_imio_ts1_datasources/destinationterm_form.html' template_name = "passerelle_imio_ts1_datasources/destinationterm_form.html"
def get_success_url(self): def get_success_url(self):
connector = ImioTs1Datasources.objects.get(slug=self.kwargs['connector_slug']) connector = ImioTs1Datasources.objects.get(slug=self.kwargs["connector_slug"])
return reverse('view-connector', return reverse(
kwargs={'connector': connector.get_connector_slug(), "view-connector",
'slug': connector.slug}) kwargs={
"connector": connector.get_connector_slug(),
"slug": connector.slug,
},
)
class DestinationtermDeleteView(DeleteView): class DestinationtermDeleteView(DeleteView):
model = DestinationTerm model = DestinationTerm
def get_success_url(self): def get_success_url(self):
connector = ImioTs1Datasources.objects.get(slug=self.kwargs['connector_slug']) connector = ImioTs1Datasources.objects.get(slug=self.kwargs["connector_slug"])
return reverse('view-connector', return reverse(
kwargs={'connector': connector.get_connector_slug(), "view-connector",
'slug': connector.slug}) kwargs={
"connector": connector.get_connector_slug(),
"slug": connector.slug,
},
)
class DestinationtermUpdateView(UpdateView): class DestinationtermUpdateView(UpdateView):
model = DestinationTerm model = DestinationTerm
fields = '__all__' fields = "__all__"
def get_success_url(self): def get_success_url(self):
connector = ImioTs1Datasources.objects.get(slug=self.kwargs['connector_slug']) connector = ImioTs1Datasources.objects.get(slug=self.kwargs["connector_slug"])
return reverse('view-connector', return reverse(
kwargs={'connector': connector.get_connector_slug(), "view-connector",
'slug': connector.slug}) kwargs={
"connector": connector.get_connector_slug(),
"slug": connector.slug,
},
)