quiet some RemovedInDjango19Warning warnings (#25222)
This commit is contained in:
parent
af036b783d
commit
5afd362bc3
|
@ -1,23 +1,22 @@
|
|||
import logging
|
||||
|
||||
from django.apps import apps
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Clean expired models of authentic2.'
|
||||
|
||||
def handle(self, **options):
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
for app in models.get_apps():
|
||||
for model in models.get_models(app):
|
||||
for app in apps.get_app_configs():
|
||||
for model in app.get_models():
|
||||
# only models from authentic2
|
||||
if not model.__module__.startswith('authentic2'):
|
||||
continue
|
||||
try:
|
||||
self.cleanup_model(model)
|
||||
except:
|
||||
log.exception('cleanup of model %s failed', model)
|
||||
if model.__module__.startswith('authentic2'):
|
||||
try:
|
||||
self.cleanup_model(model)
|
||||
except:
|
||||
log.exception('cleanup of model %s failed', model)
|
||||
|
||||
def cleanup_model(self, model):
|
||||
manager = getattr(model, 'objects', None)
|
||||
|
|
|
@ -97,7 +97,7 @@ class ExtraAttributeAction(argparse.Action):
|
|||
class Command(BaseCommand):
|
||||
'''Load LDAP ldif file'''
|
||||
can_import_django_settings = True
|
||||
requires_model_validation = True
|
||||
requires_system_checks = True
|
||||
help = 'Load/update LDIF files as users'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
|
|
|
@ -225,7 +225,7 @@ class Command(BaseCommand):
|
|||
and LibertyIdentityProvider files'''
|
||||
can_import_django_settings = True
|
||||
output_transaction = True
|
||||
requires_model_validation = True
|
||||
requires_system_checks = True
|
||||
|
||||
help = 'Load the specified SAMLv2 metadata file'
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ from django_rbac.utils import get_ou_model
|
|||
class Command(BaseCommand):
|
||||
'''Load LDAP ldif file'''
|
||||
can_import_django_settings = True
|
||||
requires_model_validation = True
|
||||
requires_system_checks = True
|
||||
help = 'Register an OpenID Connect OP'
|
||||
|
||||
def add_arguments(self, parser):
|
||||
|
|
|
@ -23,7 +23,7 @@ DELETE = 3
|
|||
class Command(BaseCommand):
|
||||
can_import_django_settings = True
|
||||
output_transaction = True
|
||||
requires_model_validation = True
|
||||
requires_system_checks = True
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('target_resource', nargs='*')
|
||||
|
|
Loading…
Reference in New Issue