Source code for shoop.admin.templatetags.shoop_admin

# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.

from bootstrap3.renderers import FormRenderer
from django.utils.safestring import mark_safe
from django_jinja import library

from shoop.admin.template_helpers import \
    shoop_admin as shoop_admin_template_helpers
from shoop.admin.utils.bs3_renderers import AdminFieldRenderer


[docs]class Bootstrap3Namespace(object):
[docs] def field(self, field, **kwargs): if not field: return "" return mark_safe(AdminFieldRenderer(field, **kwargs).render())
[docs] def form(self, form, **kwargs): return mark_safe(FormRenderer(form, **kwargs).render())
library.global_function(name="shoop_admin", fn=shoop_admin_template_helpers) library.global_function(name="bs3", fn=Bootstrap3Namespace())