Пример #1
0
 def test_model_exclude_list_add(self):
     model_list = [
         x for x in apps.get_models()
         if not issubclass(x, SimpleLogAbstract) and x is not OtherModel
     ]
     with isolate_lru_cache(get_model_list):
         self.assertListEqual(get_model_list(), model_list)
Пример #2
0
 def test_log_all_models(self):
     all_models = [
         x for x in apps.get_models()
         if not issubclass(x, SimpleLogAbstract)
     ]
     with isolate_lru_cache(get_model_list):
         self.assertListEqual(get_model_list(), all_models)
 def handle(self, *args, **options):
     self.stdout.write('')
     for model in apps.get_models():
         tracking = model in get_model_list()
         if not tracking and options['with_fields']:
             continue
         prefix = '[{}] '.format('+' if tracking else '-')
         self.stdout.write(prefix + get_label(model))
         if tracking and options['with_fields']:
             fields = get_fields(model)
             self.stdout.write(
                 '    - ' + '\n    - '.join([x.name for x in fields]), )
     self.stdout.write('')
Пример #4
0
 def test_model_list_add(self):
     with isolate_lru_cache(get_model_list):
         self.assertListEqual(get_model_list(), [OtherModel])
Пример #5
0
 def ready(self):
     if not simple_log.registered:
         for model in get_model_list():
             self.register_signals(model)
             simple_log.registered = True