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

iplweb / bpp / 69252c38-21b1-49f8-98a5-a21d59416a66

17 Feb 2025 01:27AM UTC coverage: 47.492% (+0.7%) from 46.838%
69252c38-21b1-49f8-98a5-a21d59416a66

push

circleci

mpasternak
Merge branch 'release/v202502.1156'

2 of 8 new or added lines in 3 files covered. (25.0%)

2233 existing lines in 114 files now uncovered.

16671 of 35103 relevant lines covered (47.49%)

1.2 hits per line

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

37.5
src/pbn_api/admin/widgets.py
1
# Register your models here.
2
import json
3✔
3

4
from django.forms import widgets
3✔
5

6

7
class PrettyJSONWidget(widgets.Textarea):
3✔
8
    show_only_current = False
3✔
9

10
    def format_value(self, value):
3✔
UNCOV
11
        try:
×
12
            v = json.loads(value)
×
13
            if self.show_only_current:
×
14
                # Pokazuj tylko ostatniÄ… wersjÄ™ z PBNu
15
                v = [value for value in v if value.get("current", False) is True]
×
16
            value = json.dumps(v, indent=4, sort_keys=True)
×
17
            # these lines will try to adjust size of TextArea to fit to content
18
            row_lengths = [len(r) for r in value.split("\n")]
×
UNCOV
19
            self.attrs["rows"] = min(max(len(row_lengths) + 2, 10), 60)
×
UNCOV
20
            self.attrs["cols"] = min(max(max(row_lengths) + 2, 40), 120)
×
UNCOV
21
            return value
×
UNCOV
22
        except Exception:
×
23
            # logger.warning("Error while formatting JSON: {}".format(e))
UNCOV
24
            return super().format_value(value)
×
25

26

27
class PrettyJSONWidgetReadonly(PrettyJSONWidget):
3✔
28
    def __init__(self, attrs=None):
3✔
UNCOV
29
        default_attrs = {"readonly": True}
×
UNCOV
30
        if attrs:
×
UNCOV
31
            default_attrs.update(attrs)
×
UNCOV
32
        super().__init__(default_attrs)
×
33

34

35
class PrettyJSONWidgetReadonlyOnlyCurrent(PrettyJSONWidgetReadonly):
3✔
36
    show_only_current = True
3✔
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

© 2026 Coveralls, Inc