• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zostera / django-bootstrap4 / 5399170771

pending completion
5399170771

push

github

dyve
Remove support for Python 3.7 (EOL)

272 of 344 branches covered (79.07%)

Branch coverage included in aggregate %.

704 of 793 relevant lines covered (88.78%)

3.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.74
/src/bootstrap4/components.py
1
from django.utils.safestring import mark_safe
4✔
2
from django.utils.translation import gettext as _
4✔
3

4
from bootstrap4.utils import render_tag
4✔
5

6
from .text import text_value
4✔
7

8

9
def render_alert(content, alert_type=None, dismissible=True):
4✔
10
    """Render a Bootstrap alert."""
11
    button = ""
4✔
12
    if not alert_type:
4✔
13
        alert_type = "info"
4✔
14
    css_classes = ["alert", "alert-" + text_value(alert_type)]
4✔
15
    if dismissible:
4!
16
        css_classes.append("alert-dismissible")
4✔
17
        close = _("close")
4✔
18
        button = (
4✔
19
            '<button type="button" class="close" data-dismiss="alert" aria-label="{close}">&times;</button>'
20
        ).format(close=close)
21
    button_placeholder = "__BUTTON__"
4✔
22
    return mark_safe(
4✔
23
        render_tag(
24
            "div",
25
            attrs={"class": " ".join(css_classes), "role": "alert"},
26
            content=mark_safe(button_placeholder) + text_value(content),
27
        ).replace(button_placeholder, button)
28
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc