def delete_domains(): domains = request.json['domains'] session = Domain.get(domains[0]).session for domain in domains: Domain.delete(domain) if len(session.domains) == 0: session.delete() return dict()
def domain_delete(domain_name): """Route to delete a domain.""" d = Domain() result = d.delete(domain_name) if result['status'] == 'error': return redirect(url_for('error', code=500)) history = History(msg='Delete domain %s' % domain_name, created_by=current_user.username) history.add() return redirect(url_for('dashboard'))