def delete(request, uuid): """Handle deleting connections, showing a confirmation dialog first. On GET, display a confirmation page. On POST, delete the connection. """ if request.method == 'POST': try: name = network.delete_connection(uuid) messages.success(request, _('Connection %s deleted.') % name) except network.ConnectionNotFound: messages.error(request, _('Failed to delete connection: ' 'Connection not found.')) return redirect(reverse_lazy('networks:index')) try: connection = network.get_connection(uuid) name = connection.get_id() except network.ConnectionNotFound: messages.error(request, _('Failed to delete connection: ' 'Connection not found.')) return redirect(reverse_lazy('networks:index')) return TemplateResponse(request, 'connections_delete.html', {'title': _('Delete Connection'), 'subsubmenu': subsubmenu, 'name': name})
def delete(request, uuid): """Handle deleting connections, showing a confirmation dialog first. On GET, display a confirmation page. On POST, delete the connection. """ if request.method == 'POST': try: name = network.delete_connection(uuid) messages.success(request, _('Connection {name} deleted.') .format(name=name)) except network.ConnectionNotFound: messages.error(request, _('Failed to delete connection: ' 'Connection not found.')) return redirect(reverse_lazy('networks:index')) try: connection = network.get_connection(uuid) name = connection.get_id() except network.ConnectionNotFound: messages.error(request, _('Failed to delete connection: ' 'Connection not found.')) return redirect(reverse_lazy('networks:index')) return TemplateResponse(request, 'connections_delete.html', {'title': _('Delete Connection'), 'subsubmenu': subsubmenu, 'name': name})
def delete(request, uuid): """Handle deleting connections, showing a confirmation dialog first. On GET, display a confirmation page. On POST, delete the connection. """ if request.method == "POST": try: name = network.delete_connection(uuid) messages.success(request, _("Connection %s deleted.") % name) except network.ConnectionNotFound: messages.error(request, _("Failed to delete connection: " "Connection not found.")) return redirect(reverse_lazy("networks:index")) try: connection = network.get_connection(uuid) name = connection.get_id() except network.ConnectionNotFound: messages.error(request, _("Failed to delete connection: " "Connection not found.")) return redirect(reverse_lazy("networks:index")) return TemplateResponse( request, "connections_delete.html", {"title": _("Delete Connection"), "subsubmenu": subsubmenu, "name": name} )
def tearDown(cls): network.delete_connection(cls.ethernet_uuid) network.delete_connection(cls.wifi_uuid) network.delete_connection(cls.pppoe_uuid)
def post(self, request, interface): """Delete the server.""" connection = network.get_connection_by_interface_name(interface) network.delete_connection(connection.get_uuid()) messages.success(request, _('Server deleted.')) return redirect('wireguard:index')