Example #1
0
def get_tag_object_form():
    """
    Return the cosinnus tag object model form that is defined in
    :data:`settings.COSINNUS_TAG_OBJECT_FORM`
    """
    from django.core.exceptions import ImproperlyConfigured
    from cosinnus.conf import settings

    form_class = import_from_settings('COSINNUS_TAG_OBJECT_FORM')
    if not issubclass(form_class, forms.ModelForm):
        raise ImproperlyConfigured("COSINNUS_TAG_OBJECT_FORM refers to form "
                                   "'%s' that does not exist or is not a "
                                   "ModelForm" %
                                   settings.COSINNUS_TAG_OBJECT_FORM)
    return form_class
Example #2
0
def get_tag_object_index():
    """
    Return the cosinnus tag object search index that is defined in
    :data:`settings.COSINNUS_TAG_OBJECT_SEARCH_INDEX`
    """
    from django.core.exceptions import ImproperlyConfigured
    from cosinnus.conf import settings

    index_class = import_from_settings('COSINNUS_TAG_OBJECT_SEARCH_INDEX')
    if not issubclass(index_class, indexes.SearchIndex):
        raise ImproperlyConfigured(
            "COSINNUS_TAG_OBJECT_SEARCH_INDEX refers to "
            "index '%s' that does not exist or is not a "
            "valid haystack SearchIndex." %
            settings.COSINNUS_TAG_OBJECT_SEARCH_INDEX)
    return index_class
Example #3
0
def get_tag_object_index():
    """
    Return the cosinnus tag object search index that is defined in
    :data:`settings.COSINNUS_TAG_OBJECT_SEARCH_INDEX`
    """
    from django.core.exceptions import ImproperlyConfigured
    from cosinnus.conf import settings
    
    # if the setting points at the TagObjectIndex defined here, link it directly,
    # otherwise we will get circular import problems
    if getattr(settings, 'COSINNUS_TAG_OBJECT_SEARCH_INDEX', None) == '%s.TagObjectIndex' % __name__:
        index_class = TagObjectIndex
    else:
        index_class = import_from_settings('COSINNUS_TAG_OBJECT_SEARCH_INDEX')
    
    
    if not issubclass(index_class, indexes.SearchIndex):
        raise ImproperlyConfigured("COSINNUS_TAG_OBJECT_SEARCH_INDEX refers to "
                                   "index '%s' that does not exist or is not a "
                                   "valid haystack SearchIndex." %
            settings.COSINNUS_TAG_OBJECT_SEARCH_INDEX)
    return index_class
Example #4
0
def get_user_profile_serializer():
    """
    Return the cosinnus user profile serializer that is defined in
    :data:`settings.COSINNUS_USER_PROFILE_SERIALIZER`
    """
    return import_from_settings('COSINNUS_USER_PROFILE_SERIALIZER')