def _configure_all_models(self): used_ct_ids = set(FieldsConfig.objects.values_list('content_type', flat=True)) FieldsConfig.objects.bulk_create([FieldsConfig(content_type=ct, descriptions=()) for ct in map(ContentType.objects.get_for_model, filter(FieldsConfig.is_model_valid, apps.get_models()) ) if ct.id not in used_ct_ids ] )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.cbci = FieldsConfig()
def get_form_instance(self, step): cleaned_data = self.get_cleaned_data_for_step('0') return FieldsConfig(content_type=cleaned_data['ctype'], descriptions=())