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

iplweb / bpp / 80e3a408-6e45-4572-8561-66829e6d8659

29 Aug 2025 07:31AM UTC coverage: 47.493%. Remained the same
80e3a408-6e45-4572-8561-66829e6d8659

push

circleci

mpasternak
Fix GitHub, maybe

19323 of 40686 relevant lines covered (47.49%)

1.51 hits per line

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

90.91
src/bpp/fields.py
1
from decimal import Decimal, InvalidOperation
4✔
2

3
from django import forms
4✔
4
from django.core.exceptions import ValidationError
4✔
5
from django.db import models
4✔
6

7
# Ta klasa na obecną chwilę nie zawiera nic, ale używamy jej, aby oznaczyć
8
# odpowiednio pola, gdzie chodzi o rok:
9
YearField = models.IntegerField
4✔
10

11

12
class CommaDecimalField(forms.DecimalField):
4✔
13
    """
14
    A DecimalField that accepts both comma and period as decimal separators.
15
    Converts comma to period for processing.
16
    """
17

18
    def to_python(self, value):
4✔
19
        if value in self.empty_values:
2✔
20
            return None
2✔
21

22
        if isinstance(value, str):
2✔
23
            value = value.replace(",", ".")
2✔
24

25
        try:
2✔
26
            return Decimal(str(value))
2✔
27
        except (ValueError, InvalidOperation):
×
28
            raise ValidationError(self.error_messages["invalid"])
×
29

30

31
class DOIField(models.CharField):
4✔
32
    def __init__(self, *args, **kw):
4✔
33
        if "help_text" not in kw:
4✔
34
            kw["help_text"] = "Digital Object Identifier (DOI)"
4✔
35

36
        if "max_length" not in kw:
4✔
37
            kw["max_length"] = 2048
4✔
38

39
        super().__init__(*args, **kw)
4✔
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