How to use the databases.models.Databases.objects.filter function in databases

To help you get started, we’ve selected a few databases examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github usmannasir / cyberpanel / plogical / vhost.py View on Github external
return 0
            return 1
        else:
            try:
                ## Deleting master conf
                numberOfSites = str(Websites.objects.count() + ChildDomains.objects.count())
                vhost.deleteCoreConf(virtualHostName, numberOfSites)

                delWebsite = Websites.objects.get(domain=virtualHostName)

                ## Cagefs

                command = '/usr/sbin/cagefsctl --disable %s' % (delWebsite.externalApp)
                ProcessUtilities.normalExecutioner(command)

                databases = Databases.objects.filter(website=delWebsite)

                childDomains = delWebsite.childdomains_set.all()

                ## Deleting child domains

                for items in childDomains:
                    numberOfSites = Websites.objects.count() + ChildDomains.objects.count()
                    vhost.deleteCoreConf(items.domain, numberOfSites)

                for items in databases:
                    mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)

                delWebsite.delete()

                ## Deleting DNS Zone if there is any.