Skip to content

Instantly share code, notes, and snippets.

@intgr
Created May 12, 2024 10:37
Show Gist options
  • Save intgr/352cac61b4f95e921bb33a0d4b76d324 to your computer and use it in GitHub Desktop.
Save intgr/352cac61b4f95e921bb33a0d4b76d324 to your computer and use it in GitHub Desktop.
import django
import django.apps
import django.apps.config
import django.apps.registry
import django.conf
import django.conf.global_settings
import django.conf.locale
import django.conf.urls
import django.conf.urls.i18n
import django.conf.urls.static
import django.contrib
import django.contrib.admin
import django.contrib.admin.actions
import django.contrib.admin.apps
import django.contrib.admin.checks
import django.contrib.admin.decorators
import django.contrib.admin.exceptions
import django.contrib.admin.filters
import django.contrib.admin.forms
import django.contrib.admin.helpers
import django.contrib.admin.migrations
import django.contrib.admin.models
import django.contrib.admin.options
import django.contrib.admin.sites
import django.contrib.admin.templatetags
import django.contrib.admin.templatetags.admin_list
import django.contrib.admin.templatetags.admin_modify
import django.contrib.admin.templatetags.admin_urls
import django.contrib.admin.templatetags.base
import django.contrib.admin.templatetags.log
import django.contrib.admin.tests
import django.contrib.admin.utils
import django.contrib.admin.views
import django.contrib.admin.views.autocomplete
import django.contrib.admin.views.decorators
import django.contrib.admin.views.main
import django.contrib.admin.widgets
import django.contrib.admindocs
import django.contrib.admindocs.apps
import django.contrib.admindocs.middleware
import django.contrib.admindocs.urls
import django.contrib.admindocs.utils
import django.contrib.admindocs.views
import django.contrib.auth
import django.contrib.auth.admin
import django.contrib.auth.apps
import django.contrib.auth.backends
import django.contrib.auth.base_user
import django.contrib.auth.checks
import django.contrib.auth.context_processors
import django.contrib.auth.decorators
import django.contrib.auth.forms
import django.contrib.auth.handlers
import django.contrib.auth.handlers.modwsgi
import django.contrib.auth.hashers
import django.contrib.auth.management
import django.contrib.auth.management.commands
import django.contrib.auth.management.commands.changepassword
import django.contrib.auth.management.commands.createsuperuser
import django.contrib.auth.middleware
import django.contrib.auth.migrations
import django.contrib.auth.mixins
import django.contrib.auth.models
import django.contrib.auth.password_validation
import django.contrib.auth.signals
import django.contrib.auth.tokens
import django.contrib.auth.urls
import django.contrib.auth.validators
import django.contrib.auth.views
import django.contrib.contenttypes
import django.contrib.contenttypes.admin
import django.contrib.contenttypes.apps
import django.contrib.contenttypes.checks
import django.contrib.contenttypes.fields
import django.contrib.contenttypes.forms
import django.contrib.contenttypes.management
import django.contrib.contenttypes.management.commands
import django.contrib.contenttypes.management.commands.remove_stale_contenttypes
import django.contrib.contenttypes.migrations
import django.contrib.contenttypes.models
import django.contrib.contenttypes.views
import django.contrib.flatpages
import django.contrib.flatpages.admin
import django.contrib.flatpages.apps
import django.contrib.flatpages.forms
import django.contrib.flatpages.middleware
import django.contrib.flatpages.migrations
import django.contrib.flatpages.models
import django.contrib.flatpages.sitemaps
import django.contrib.flatpages.templatetags
import django.contrib.flatpages.templatetags.flatpages
import django.contrib.flatpages.urls
import django.contrib.flatpages.views
import django.contrib.gis
import django.contrib.gis.admin
import django.contrib.gis.admin.options
import django.contrib.gis.apps
import django.contrib.gis.db
import django.contrib.gis.db.backends
import django.contrib.gis.db.backends.base
import django.contrib.gis.db.backends.base.adapter
import django.contrib.gis.db.backends.base.features
import django.contrib.gis.db.backends.base.models
import django.contrib.gis.db.backends.base.operations
import django.contrib.gis.db.models
import django.contrib.gis.db.models.aggregates
import django.contrib.gis.db.models.fields
import django.contrib.gis.db.models.functions
import django.contrib.gis.db.models.lookups
import django.contrib.gis.db.models.proxy
import django.contrib.gis.db.models.sql
import django.contrib.gis.db.models.sql.conversion
import django.contrib.gis.feeds
import django.contrib.gis.forms
import django.contrib.gis.forms.fields
import django.contrib.gis.forms.widgets
import django.contrib.gis.gdal
import django.contrib.gis.gdal.base
import django.contrib.gis.gdal.datasource
import django.contrib.gis.gdal.driver
import django.contrib.gis.gdal.envelope
import django.contrib.gis.gdal.error
import django.contrib.gis.gdal.feature
import django.contrib.gis.gdal.field
import django.contrib.gis.gdal.geometries
import django.contrib.gis.gdal.geomtype
import django.contrib.gis.gdal.layer
import django.contrib.gis.gdal.libgdal
import django.contrib.gis.gdal.prototypes
import django.contrib.gis.gdal.prototypes.ds
import django.contrib.gis.gdal.prototypes.errcheck
import django.contrib.gis.gdal.prototypes.generation
import django.contrib.gis.gdal.prototypes.geom
import django.contrib.gis.gdal.prototypes.raster
import django.contrib.gis.gdal.prototypes.srs
import django.contrib.gis.gdal.raster
import django.contrib.gis.gdal.raster.band
import django.contrib.gis.gdal.raster.base
import django.contrib.gis.gdal.raster.const
import django.contrib.gis.gdal.raster.source
import django.contrib.gis.gdal.srs
import django.contrib.gis.geometry
import django.contrib.gis.geos
import django.contrib.gis.geos.base
import django.contrib.gis.geos.collections
import django.contrib.gis.geos.coordseq
import django.contrib.gis.geos.error
import django.contrib.gis.geos.factory
import django.contrib.gis.geos.geometry
import django.contrib.gis.geos.io
import django.contrib.gis.geos.libgeos
import django.contrib.gis.geos.linestring
import django.contrib.gis.geos.mutable_list
import django.contrib.gis.geos.point
import django.contrib.gis.geos.polygon
import django.contrib.gis.geos.prepared
import django.contrib.gis.geos.prototypes
import django.contrib.gis.geos.prototypes.coordseq
import django.contrib.gis.geos.prototypes.errcheck
import django.contrib.gis.geos.prototypes.geom
import django.contrib.gis.geos.prototypes.io
import django.contrib.gis.geos.prototypes.misc
import django.contrib.gis.geos.prototypes.predicates
import django.contrib.gis.geos.prototypes.prepared
import django.contrib.gis.geos.prototypes.threadsafe
import django.contrib.gis.geos.prototypes.topology
import django.contrib.gis.measure
import django.contrib.gis.ptr
import django.contrib.gis.serializers
import django.contrib.gis.serializers.geojson
import django.contrib.gis.shortcuts
import django.contrib.gis.sitemaps
import django.contrib.gis.sitemaps.kml
import django.contrib.gis.sitemaps.views
import django.contrib.gis.utils
import django.contrib.gis.utils.layermapping
import django.contrib.gis.utils.ogrinfo
import django.contrib.gis.utils.ogrinspect
import django.contrib.gis.utils.srs
import django.contrib.gis.views
import django.contrib.humanize
import django.contrib.humanize.apps
import django.contrib.humanize.templatetags
import django.contrib.humanize.templatetags.humanize
import django.contrib.messages
import django.contrib.messages.api
import django.contrib.messages.apps
import django.contrib.messages.constants
import django.contrib.messages.context_processors
import django.contrib.messages.middleware
import django.contrib.messages.storage
import django.contrib.messages.storage.base
import django.contrib.messages.storage.cookie
import django.contrib.messages.storage.fallback
import django.contrib.messages.storage.session
import django.contrib.messages.utils
import django.contrib.messages.views
import django.contrib.redirects
import django.contrib.redirects.admin
import django.contrib.redirects.apps
import django.contrib.redirects.middleware
import django.contrib.redirects.migrations
import django.contrib.redirects.models
import django.contrib.sessions
import django.contrib.sessions.apps
import django.contrib.sessions.backends
import django.contrib.sessions.backends.base
import django.contrib.sessions.backends.cache
import django.contrib.sessions.backends.cached_db
import django.contrib.sessions.backends.db
import django.contrib.sessions.backends.file
import django.contrib.sessions.backends.signed_cookies
import django.contrib.sessions.base_session
import django.contrib.sessions.exceptions
import django.contrib.sessions.management
import django.contrib.sessions.management.commands
import django.contrib.sessions.management.commands.clearsessions
import django.contrib.sessions.middleware
import django.contrib.sessions.migrations
import django.contrib.sessions.models
import django.contrib.sessions.serializers
import django.contrib.sitemaps
import django.contrib.sitemaps.apps
import django.contrib.sitemaps.views
import django.contrib.sites
import django.contrib.sites.admin
import django.contrib.sites.apps
import django.contrib.sites.checks
import django.contrib.sites.management
import django.contrib.sites.managers
import django.contrib.sites.middleware
import django.contrib.sites.migrations
import django.contrib.sites.models
import django.contrib.sites.requests
import django.contrib.sites.shortcuts
import django.contrib.staticfiles
import django.contrib.staticfiles.apps
import django.contrib.staticfiles.checks
import django.contrib.staticfiles.finders
import django.contrib.staticfiles.handlers
import django.contrib.staticfiles.management
import django.contrib.staticfiles.management.commands
import django.contrib.staticfiles.management.commands.collectstatic
import django.contrib.staticfiles.management.commands.findstatic
import django.contrib.staticfiles.management.commands.runserver
import django.contrib.staticfiles.storage
import django.contrib.staticfiles.testing
import django.contrib.staticfiles.urls
import django.contrib.staticfiles.utils
import django.contrib.staticfiles.views
import django.contrib.syndication
import django.contrib.syndication.apps
import django.contrib.syndication.views
import django.core
import django.core.asgi
import django.core.cache
import django.core.cache.backends
import django.core.cache.backends.base
import django.core.cache.backends.db
import django.core.cache.backends.dummy
import django.core.cache.backends.filebased
import django.core.cache.backends.locmem
import django.core.cache.backends.memcached
import django.core.cache.backends.redis
import django.core.cache.utils
import django.core.checks
import django.core.checks.async_checks
import django.core.checks.caches
import django.core.checks.compatibility
import django.core.checks.compatibility.django_4_0
import django.core.checks.database
import django.core.checks.files
import django.core.checks.messages
import django.core.checks.model_checks
import django.core.checks.registry
import django.core.checks.security
import django.core.checks.security.base
import django.core.checks.security.csrf
import django.core.checks.security.sessions
import django.core.checks.templates
import django.core.checks.translation
import django.core.checks.urls
import django.core.exceptions
import django.core.files
import django.core.files.base
import django.core.files.images
import django.core.files.locks
import django.core.files.move
import django.core.files.storage
import django.core.files.storage.base
import django.core.files.storage.filesystem
import django.core.files.storage.handler
import django.core.files.storage.memory
import django.core.files.storage.mixins
import django.core.files.temp
import django.core.files.uploadedfile
import django.core.files.uploadhandler
import django.core.files.utils
import django.core.handlers
import django.core.handlers.asgi
import django.core.handlers.base
import django.core.handlers.exception
import django.core.handlers.wsgi
import django.core.mail
import django.core.mail.backends
import django.core.mail.backends.base
import django.core.mail.backends.console
import django.core.mail.backends.dummy
import django.core.mail.backends.filebased
import django.core.mail.backends.locmem
import django.core.mail.backends.smtp
import django.core.mail.message
import django.core.mail.utils
import django.core.management
import django.core.management.base
import django.core.management.color
import django.core.management.commands
import django.core.management.commands.check
import django.core.management.commands.compilemessages
import django.core.management.commands.createcachetable
import django.core.management.commands.dbshell
import django.core.management.commands.diffsettings
import django.core.management.commands.dumpdata
import django.core.management.commands.flush
import django.core.management.commands.inspectdb
import django.core.management.commands.loaddata
import django.core.management.commands.makemessages
import django.core.management.commands.makemigrations
import django.core.management.commands.migrate
import django.core.management.commands.runserver
import django.core.management.commands.sendtestemail
import django.core.management.commands.shell
import django.core.management.commands.showmigrations
import django.core.management.commands.sqlflush
import django.core.management.commands.sqlmigrate
import django.core.management.commands.sqlsequencereset
import django.core.management.commands.squashmigrations
import django.core.management.commands.startapp
import django.core.management.commands.startproject
import django.core.management.commands.test
import django.core.management.commands.testserver
import django.core.management.sql
import django.core.management.templates
import django.core.management.utils
import django.core.paginator
import django.core.serializers
import django.core.serializers.base
import django.core.serializers.json
import django.core.serializers.jsonl
import django.core.serializers.python
import django.core.serializers.xml_serializer
import django.core.servers
import django.core.servers.basehttp
import django.core.signals
import django.core.signing
import django.core.validators
import django.core.wsgi
import django.db
import django.db.backends
import django.db.backends.base
import django.db.backends.base.base
import django.db.backends.base.client
import django.db.backends.base.creation
import django.db.backends.base.features
import django.db.backends.base.introspection
import django.db.backends.base.operations
import django.db.backends.base.schema
import django.db.backends.base.validation
import django.db.backends.ddl_references
import django.db.backends.dummy
import django.db.backends.dummy.base
import django.db.backends.dummy.features
import django.db.backends.signals
import django.db.backends.sqlite3
import django.db.backends.sqlite3.base
import django.db.backends.sqlite3.client
import django.db.backends.sqlite3.creation
import django.db.backends.sqlite3.features
import django.db.backends.sqlite3.introspection
import django.db.backends.sqlite3.operations
import django.db.backends.sqlite3.schema
import django.db.backends.utils
import django.db.migrations
import django.db.migrations.autodetector
import django.db.migrations.exceptions
import django.db.migrations.executor
import django.db.migrations.graph
import django.db.migrations.loader
import django.db.migrations.migration
import django.db.migrations.operations
import django.db.migrations.operations.base
import django.db.migrations.operations.fields
import django.db.migrations.operations.models
import django.db.migrations.operations.special
import django.db.migrations.optimizer
import django.db.migrations.questioner
import django.db.migrations.recorder
import django.db.migrations.serializer
import django.db.migrations.state
import django.db.migrations.utils
import django.db.migrations.writer
import django.db.models
import django.db.models.aggregates
import django.db.models.base
import django.db.models.constants
import django.db.models.constraints
import django.db.models.deletion
import django.db.models.enums
import django.db.models.expressions
import django.db.models.fields
import django.db.models.fields.files
import django.db.models.fields.generated
import django.db.models.fields.json
import django.db.models.fields.mixins
import django.db.models.fields.proxy
import django.db.models.fields.related
import django.db.models.fields.related_descriptors
import django.db.models.fields.related_lookups
import django.db.models.fields.reverse_related
import django.db.models.functions
import django.db.models.functions.comparison
import django.db.models.functions.datetime
import django.db.models.functions.math
import django.db.models.functions.mixins
import django.db.models.functions.text
import django.db.models.functions.window
import django.db.models.indexes
import django.db.models.lookups
import django.db.models.manager
import django.db.models.options
import django.db.models.query
import django.db.models.query_utils
import django.db.models.signals
import django.db.models.sql
import django.db.models.sql.compiler
import django.db.models.sql.constants
import django.db.models.sql.datastructures
import django.db.models.sql.query
import django.db.models.sql.subqueries
import django.db.models.sql.where
import django.db.models.utils
import django.db.transaction
import django.db.utils
import django.dispatch
import django.dispatch.dispatcher
import django.forms
import django.forms.boundfield
import django.forms.fields
import django.forms.forms
import django.forms.formsets
import django.forms.models
import django.forms.renderers
import django.forms.utils
import django.forms.widgets
import django.http
import django.http.cookie
import django.http.multipartparser
import django.http.request
import django.http.response
import django.middleware
import django.middleware.cache
import django.middleware.clickjacking
import django.middleware.common
import django.middleware.csrf
import django.middleware.gzip
import django.middleware.http
import django.middleware.locale
import django.middleware.security
import django.shortcuts
import django.template
import django.template.backends
import django.template.backends.base
import django.template.backends.django
import django.template.backends.dummy
import django.template.backends.utils
import django.template.base
import django.template.context
import django.template.context_processors
import django.template.defaultfilters
import django.template.defaulttags
import django.template.engine
import django.template.exceptions
import django.template.library
import django.template.loader
import django.template.loader_tags
import django.template.loaders
import django.template.loaders.app_directories
import django.template.loaders.base
import django.template.loaders.cached
import django.template.loaders.filesystem
import django.template.loaders.locmem
import django.template.response
import django.template.smartif
import django.template.utils
import django.templatetags
import django.templatetags.cache
import django.templatetags.i18n
import django.templatetags.l10n
import django.templatetags.static
import django.templatetags.tz
import django.test
import django.test.client
import django.test.html
import django.test.runner
import django.test.selenium
import django.test.signals
import django.test.testcases
import django.test.utils
import django.urls
import django.urls.base
import django.urls.conf
import django.urls.converters
import django.urls.exceptions
import django.urls.resolvers
import django.urls.utils
import django.utils
import django.utils._os
import django.utils.archive
import django.utils.asyncio
import django.utils.autoreload
import django.utils.cache
import django.utils.choices
import django.utils.connection
import django.utils.crypto
import django.utils.datastructures
import django.utils.dateformat
import django.utils.dateparse
import django.utils.dates
import django.utils.deconstruct
import django.utils.decorators
import django.utils.deprecation
import django.utils.duration
import django.utils.encoding
import django.utils.feedgenerator
import django.utils.formats
import django.utils.functional
import django.utils.hashable
import django.utils.html
import django.utils.http
import django.utils.inspect
import django.utils.ipv6
import django.utils.itercompat
import django.utils.jslex
import django.utils.log
import django.utils.lorem_ipsum
import django.utils.module_loading
import django.utils.numberformat
import django.utils.regex_helper
import django.utils.safestring
import django.utils.termcolors
import django.utils.text
import django.utils.timesince
import django.utils.timezone
import django.utils.translation
import django.utils.translation.reloader
import django.utils.translation.template
import django.utils.translation.trans_null
import django.utils.translation.trans_real
import django.utils.tree
import django.utils.version
import django.utils.xmlutils
import django.views
import django.views.csrf
import django.views.debug
import django.views.decorators
import django.views.decorators.cache
import django.views.decorators.clickjacking
import django.views.decorators.common
import django.views.decorators.csrf
import django.views.decorators.debug
import django.views.decorators.gzip
import django.views.decorators.http
import django.views.decorators.vary
import django.views.defaults
import django.views.generic
import django.views.generic.base
import django.views.generic.dates
import django.views.generic.detail
import django.views.generic.edit
import django.views.generic.list
import django.views.i18n
import django.views.static
from django.db.models import Model
from django.conf import settings
# settings.configure(DEBUG=True)
# django.setup()
def inheritors(klass: type) -> set[type]:
subclasses = set()
work = [klass]
while work:
parent = work.pop()
for child in parent.__subclasses__():
if child not in subclasses:
subclasses.add(child)
work.append(child)
return subclasses
for klass in inheritors(Model):
try:
klass.Meta
print(f"✅ {klass.__module__}.{klass.__qualname__} => {klass.Meta.__qualname__}")
except AttributeError:
print(f"❌ No Meta: {klass.__module__}.{klass.__qualname__}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment