from random import randint from django.template import Template from django.template.loader import render_to_string from django.utils.safestring import SafeString from django.utils.text import slugify from .layout import Div, Field, LayoutObject, TemplateNameMixin from .utils import TEMPLATE_PACK, flatatt, render_field class PrependedAppendedText(Field): """ Layout object for rendering a field with prepended and appended text. Attributes ---------- template : str The default template which this Layout Object will be rendered with. attrs : dict Attributes to be applied to the field. These are converted into html attributes. e.g. ``data_id: 'test'`` in the attrs dict will become ``data-id='test'`` on the field's ````. Parameters ---------- field : str The name of the field to be rendered. prepended_text : str, optional The prepended text, can be HTML like, by default None appended_text : str, optional The appended text, can be HTML like, by default None input_size : str, optional For Bootstrap4+ additional classes to customise the input-group size e.g. ``input-group-sm``. By default None active : bool For Bootstrap3, a boolean to render the text active. By default ``False``. css_class : str, optional CSS classes to be applied to the field. These are added to any classes included in the ``attrs`` dict. By default ``None``. wrapper_class: str, optional CSS classes to be used when rendering the Field. This class is usually applied to the ``
`` which wraps the Field's ``