diff --git a/back/admin/integrations/builder_views.py b/back/admin/integrations/builder_views.py index 66ec40752..691c2c8b4 100644 --- a/back/admin/integrations/builder_views.py +++ b/back/admin/integrations/builder_views.py @@ -4,11 +4,11 @@ from django.contrib.messages.views import SuccessMessageMixin from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render -from django.urls import reverse +from django.urls import reverse, reverse_lazy from django.utils.translation import gettext as _ from django.views.generic import View from django.views.generic.detail import DetailView, SingleObjectMixin -from django.views.generic.edit import CreateView, FormView +from django.views.generic.edit import CreateView, FormView, UpdateView from admin.integrations.exceptions import ( DataIsNotJSONError, @@ -66,6 +66,18 @@ def get_context_data(self, **kwargs): return context +class IntegrationBuilderMakeActiveUpdateView( + LoginRequiredMixin, AdminPermMixin, UpdateView +): + model = Integration + fields = [] + success_url = reverse_lazy("settings:integrations") + + def form_valid(self, form): + form.instance.is_active = True + return super().form_valid(form) + + class IntegrationBuilderView(LoginRequiredMixin, AdminPermMixin, DetailView): template_name = "manifest_test.html" model = Integration diff --git a/back/admin/integrations/urls.py b/back/admin/integrations/urls.py index 97fad63dc..07af52759 100644 --- a/back/admin/integrations/urls.py +++ b/back/admin/integrations/urls.py @@ -12,6 +12,11 @@ name="delete", ), path("update//", views.IntegrationUpdateView.as_view(), name="update"), + path( + "make_active//", + builder_views.IntegrationBuilderMakeActiveUpdateView.as_view(), + name="make_active", + ), path( "create/google_login/", views.IntegrationCreateGoogleLoginView.as_view(), diff --git a/back/admin/settings/templates/settings_integrations.html b/back/admin/settings/templates/settings_integrations.html index 5e70129c7..68bdab488 100644 --- a/back/admin/settings/templates/settings_integrations.html +++ b/back/admin/settings/templates/settings_integrations.html @@ -121,6 +121,12 @@ {% translate "Live edit and test integration" %} +
+ {% csrf_token %} + +
{% translate "Remove" %}