Returns a list of content types from the models defined in settings.
964626
def _get_seo_content_types(seo_models):
    """"""
    try:
        return [ContentType.objects.get_for_model(m).id for m in seo_models]
    except Exception:  # previously caught DatabaseError
        # Return an empty list if this is called too early
        return []
54022
def get_content_models(self):
        
        models = []

        for model in self.concrete_model.get_content_models():
            try:
                admin_url(model, "add")
            except NoReverseMatch:
                continue
            else:
                setattr(model, "meta_verbose_name", model._meta.verbose_name)
                setattr(model, "add_url", admin_url(model, "add"))
                models.append(model)

        return models
929234
def get_model_classes(self):
        
        self._import_plugins()
        return [plugin.model for plugin in self.plugins.values()]
164726
def listMetaContentTypes(self):
        

        all_md_content_types = (
            CT_CORE_PROPS,
            CT_EXT_PROPS,
            CT_CUSTOM_PROPS)
        return [k for k in self.overrides.keys() if k in all_md_content_types]
344326
def settings():
    
    # Get the user-provided settings
    user_settings = dict(getattr(django_settings, _settings_key, {}))
    user_settings_keys = set(user_settings.keys())
    # Check for required but missing settings
    missing = _required_settings_keys - user_settings_keys
    if missing:
        raise AuthzConfigurationError(
            'Missing required {} config: {}'.format(_settings_key, missing))
    # Check for unknown settings
    unknown = user_settings_keys - _available_settings_keys
    if unknown:
        raise AuthzConfigurationError(
            'Unknown {} config params: {}'.format(_settings_key, unknown))
    # Merge defaults with provided settings
    defaults = _available_settings_keys - user_settings_keys
    user_settings.update({key: _available_settings[key] for key in defaults})

    _rectify(user_settings)
    return types.MappingProxyType(user_settings)
1062045
def get_model_list(class_list):
    
    for idx, item in enumerate(class_list):
        if isinstance(item, six.string_types):
            model_class = apps.get_model(item)
            class_list[idx] = model_class
735446
def get_document_models():
    """"""
    mappings = {}
    for i in get_index_names():
        for m in get_index_models(i):
            key = "%s.%s" % (i, m._meta.model_name)
            mappings[key] = m
    return mappings
1068335
def get_for_model(self, model):
        
        return self.filter(content_type=ContentType.objects.get_for_model(model))
862955
def applicable_models(self):
        
        Page        = apps.get_model('wagtailcore', 'Page')
        applicable  = []

        for model in apps.get_models():
            meta    = getattr(model, '_meta')
            fields  = meta.get_all_field_names()

            if issubclass(model, Page) and 'tags' in fields:
                applicable.append(model)

        return applicable
416131
def get_queryset(self):
        '''
        
        '''
        model_type = self.request.GET.get("type")
        pk = self.request.GET.get("id")
        content_type_model = ContentType.objects.get(model=model_type.lower())
        Model = content_type_model.model_class()
        model_obj = Model.objects.filter(id=pk).first()
        return Comment.objects.filter_by_object(model_obj)
199578
def list_settings(self):
        
        result = super().list_settings()
        result.append((self.SETTING_FLAG_BORDER, True))
        result.append((self.SETTING_BORDER_FORMATING, {}))
        result.append((self.SETTING_BORDER_STYLE, 'utf8.a'))
        return result
781614
def get_content_models(cls):
        
        concrete_model = base_concrete_model(ContentTyped, cls)
        return [m for m in apps.get_models()
                if m is not concrete_model and issubclass(m, concrete_model)]
1186081
def get_generic_fields():
    """"""
    generic_fields = []
    for model in apps.get_models():
        for field_name, field in model.__dict__.items():
            if isinstance(field, GenericForeignKey):
                generic_fields.append(field)
    return generic_fields
864660
def models(self):
        
        app = get_app(self.__class__.__module__.split('.')[-2])
        return get_models(app)
615796
def smart_content_type_for_model(model):
    
    try:
        # noinspection PyPackageRequirements,PyUnresolvedReferences
        from django.contrib.contenttypes.models import ContentType
    except ImportError:
        print("Django is required but cannot be imported.")
        raise

    if model._meta.proxy:
        return ContentType.objects.get(app_label=model._meta.app_label,
                                       model=model._meta.object_name.lower())
    else:
        return ContentType.objects.get_for_model(model)
236952
def models_of_config(config):
    
    resources = resources_of_config(config)
    models = []
    for resource in resources:
        if not hasattr(resource, '__table__') and hasattr(resource, 'model'):
            models.append(resource.model)
        else:
            models.append(resource)
    return models
741573
def get_avail_models(request):
    
    items = []
    admin_site = get_admin_site(request=request)

    for model, model_admin in admin_site._registry.items():
        perms = model_admin.get_model_perms(request)
        if True not in perms.values():
            continue
        items.append((model, perms,))
    return items