How to use the feincms.settings function in FeinCMS

To help you get started, we’ve selected a few FeinCMS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthiask / django-content-editor / content_editor / templatetags / _tags.py View on Github external
def _get_page_model():
    return apps.get_model(
        *feincms_settings.FEINCMS_DEFAULT_PAGE_MODEL.split('.'))
github feincms / feincms / feincms / admin / treelist_editor.py View on Github external
_fn.editable_boolean_field = attr
    return _fn


class TreelistEditor(admin.ModelAdmin):
    class Media:
        css = {}
        js = []
        if settings.FEINCMS_ADMIN_MEDIA_HOTLINKING:
            js.extend(( "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js", ))
        else:
            js.extend(( settings.FEINCMS_ADMIN_MEDIA + "jquery-1.3.2.min.js", ))

        js.extend(( settings.FEINCMS_ADMIN_MEDIA + "ie_compat.js",
                    settings.FEINCMS_ADMIN_MEDIA + "jquery.cookie.js" ,
                    settings.FEINCMS_ADMIN_MEDIA + "toolbox.js",
                    settings.FEINCMS_ADMIN_MEDIA + "page_toolbox.js",
                    ))

    def __init__(self, *args, **kwargs):
        super(TreelistEditor, self).__init__(*args, **kwargs)

        self.list_display = list(self.list_display)

        if 'indented_short_title' not in self.list_display:
            if self.list_display[0] == 'action_checkbox':
                self.list_display[1] = 'indented_short_title'
            else:
                self.list_display[0] = 'indented_short_title'
        self.list_display_links = ('indented_short_title',)

        opts = self.model._meta
github feincms / feincms / feincms / infanta / middleware.py View on Github external
def process_view(self, request, func, vargs, vkwargs):
        # do not process functions marked with @infanta_exclude
        if getattr(func, '_infanta_exclude ', False):
            return

        for url in settings.INFANTA_EXCLUDE_URLS:
            if request.path.startswith(url):
                return

        page = Page.objects.best_match_for_path(request.path)

        if not page:
        	return

        '''
        extend the page object, so we have an attribute to access 
        our view contents in the templatetag  as well as in the render method 
        of the content type
        '''
        page.vc_manager = {}

        # run request processors and return short-circuit the response handling
github matthiask / django-content-editor / feincms / admin / tree_editor.py View on Github external
def has_change_permission(self, request, obj=None):
        """
        Implement a lookup for object level permissions. Basically the same as
        ModelAdmin.has_change_permission, but also passes the obj parameter in.
        """
        perm = self.object_change_permission
        if settings.FEINCMS_TREE_EDITOR_OBJECT_PERMISSIONS:
            r = request.user.has_perm(perm, obj)
        else:
            r = request.user.has_perm(perm)

        return r and super(TreeEditor, self).has_change_permission(
            request, obj)
github feincms / feincms / feincms / content / image / models.py View on Github external
('noop', 'Do not resize'),
                ('cropscale:100x100', 'Square Thumbnail'),
                ('cropscale:200x450', 'Medium Portait'),
                ('thumbnail:1000x1000', 'Large'),
            ))

        Note that FORMAT_CHOICES is optional. The part before the colon
        corresponds to the template filters in the ``feincms_thumbnail``
        template filter library. Known values are ``cropscale`` and
        ``thumbnail``. Everything else (such as ``noop``) is ignored.
    """

    image = models.ImageField(
        _("image"),
        max_length=255,
        upload_to=os.path.join(settings.FEINCMS_UPLOAD_PREFIX, "imagecontent"),
    )
    alt_text = models.CharField(
        _("alternate text"),
        max_length=255,
        blank=True,
        help_text=_("Description of image"),
    )
    caption = models.CharField(_("caption"), max_length=255, blank=True)

    class Meta:
        abstract = True
        verbose_name = _("image")
        verbose_name_plural = _("images")

    def render(self, **kwargs):
        templates = ["content/image/default.html"]
github matthiask / django-content-editor / feincms / extensions / translations.py View on Github external
choices=django_settings.LANGUAGES,
                default=django_settings.LANGUAGES[0][0]))
        cls.add_to_class(
            'translation_of',
            models.ForeignKey(
                'self',
                blank=True, null=True, verbose_name=_('translation of'),
                related_name='translations',
                limit_choices_to={'language': django_settings.LANGUAGES[0][0]},
                help_text=_(
                    'Leave this empty for entries in the primary language.'),
            )
        )

        if hasattr(cls, 'register_request_processor'):
            if settings.FEINCMS_TRANSLATION_POLICY == "EXPLICIT":
                cls.register_request_processor(
                    translations_request_processor_explicit,
                    key='translations')
            else:  # STANDARD
                cls.register_request_processor(
                    translations_request_processor_standard,
                    key='translations')

        if hasattr(cls, 'get_redirect_to_target'):
            original_get_redirect_to_target = cls.get_redirect_to_target

            @monkeypatch_method(cls)
            def get_redirect_to_target(self, request):
                """
                Find an acceptable redirect target. If this is a local link,
                then try to find the page this redirect references and
github matthiask / django-content-editor / feincms / module / medialibrary / models.py View on Github external
verbose_name = _('category')
        verbose_name_plural = _('categories')

    def __unicode__(self):
        if self.parent_id:
            return u'%s - %s' % (self.parent.title, self.title)

        return self.title

# ------------------------------------------------------------------------
class MediaFileBase(Base, TranslatedObjectMixin):

    # XXX maybe have a look at settings.DEFAULT_FILE_STORAGE here?
    from django.core.files.storage import FileSystemStorage
    fs = FileSystemStorage(location=settings.FEINCMS_MEDIALIBRARY_ROOT,
                           base_url=settings.FEINCMS_MEDIALIBRARY_URL)

    file = models.FileField(_('file'), max_length=255, upload_to=settings.FEINCMS_MEDIALIBRARY_UPLOAD_TO, storage=fs)
    type = models.CharField(_('file type'), max_length=12, editable=False, choices=())
    created = models.DateTimeField(_('created'), editable=False, default=datetime.now)
    copyright = models.CharField(_('copyright'), max_length=200, blank=True)
    file_size  = models.IntegerField(_("file size"), blank=True, null=True, editable=False)

    categories = models.ManyToManyField(Category, verbose_name=_('categories'),
                                        blank=True, null=True)
    categories.category_filter = True

    class Meta:
        abstract = True
        verbose_name = _('media file')
        verbose_name_plural = _('media files')
github feincms / feincms / feincms / module / page / extensions / relatedpages.py View on Github external
def handle_model(self):
        self.model.add_to_class(
            "related_pages",
            models.ManyToManyField(
                settings.FEINCMS_DEFAULT_PAGE_MODEL,
                blank=True,
                related_name="%(app_label)s_%(class)s_related",
                help_text=_("Select pages that should be listed as related content."),
            ),
github feincms / feincms / feincms / admin / splitpane_editor.py View on Github external
# XXX the default manager isn't guaranteed to have a method
        # named "active" at all...
        try:
            inactive_nodes = self.model._default_manager.exclude(
                id__in=self.model._default_manager.active()).values_list('id', flat=True)
        except AttributeError:
            inactive_nodes = []

        opts = self.model._meta

        context = {
            'opts': opts,
            'root_path': self.admin_site.root_path,
            'inactive_nodes': ', '.join('#item%d' % i for i in inactive_nodes),
            'FEINCMS_ADMIN_MEDIA': settings.FEINCMS_ADMIN_MEDIA,
            'FEINCMS_ADMIN_TREE_DRAG_AND_DROP': settings.FEINCMS_ADMIN_TREE_DRAG_AND_DROP
            }

        if self.delayed_tree_loading():
            context['object_list'] = self.model._tree_manager.root_nodes()
        else:
            context['object_list'] = self.model._tree_manager.all()
            context['full_object_list'] = True

        return render_to_response([
            'admin/feincms/%s/%s/splitpane_editor_tree.html' % (opts.app_label, opts.object_name.lower()),
            'admin/feincms/%s/splitpane_editor_tree.html' % opts.app_label,
            'admin/feincms/splitpane_editor_tree.html',
            ], context, context_instance=template.RequestContext(request))