• 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

100.0
src/bpp/forms/__init__.py
1
from crispy_forms.helper import FormHelper
4✔
2
from crispy_forms.layout import Hidden
4✔
3
from crispy_forms.utils import TEMPLATE_PACK
4✔
4
from crispy_forms_foundation.layout import ButtonHolder, Fieldset, Layout, Submit
4✔
5
from django.template.loader import render_to_string
4✔
6

7
from django.contrib.auth import REDIRECT_FIELD_NAME
4✔
8
from django.contrib.auth.forms import AuthenticationForm
4✔
9

10

11
class SecureNextLink(Hidden):
4✔
12
    def render(self, form, context, template_pack=TEMPLATE_PACK, **kwargs):
4✔
13
        """
14
        Renders an `<input />` if container is used as a Layout object.
15
        Input button value can be a variable in context.
16
        """
17
        # django-crispy-forms traktuje wartość jako... templatkę, więc w ten sposób moglibyśmy
18
        # umożliwić zdalnemu użytkownikowi uruchamianie kodu na serwerze:
19

20
        # self.value = Template(str(self.value)).render(context)
21

22
        template = self.get_template_name(template_pack)
1✔
23
        context.update({"input": self})
1✔
24
        return render_to_string(template, context.flatten())
1✔
25

26

27
class MyAuthenticationForm(AuthenticationForm):
4✔
28
    def __init__(self, request=None, *args, **kw):
4✔
29
        self.helper = FormHelper()
1✔
30
        self.helper.form_class = "custom"
1✔
31
        self.helper.form_action = "."
1✔
32

33
        # Get the next parameter from the request
34
        next_url = ""
1✔
35
        if request:
1✔
36
            next_url = request.GET.get(REDIRECT_FIELD_NAME, "")
1✔
37

38
        self.helper.layout = Layout(
1✔
39
            Fieldset(
40
                "Zaloguj się!",
41
                "username",
42
                "password",
43
                SecureNextLink(REDIRECT_FIELD_NAME, next_url),
44
            ),
45
            ButtonHolder(
46
                Submit(
47
                    "submit",
48
                    "Zaloguj się",
49
                    css_id="id_submit",
50
                    css_class="submit button",
51
                ),
52
            ),
53
        )
54
        AuthenticationForm.__init__(self, request, *args, **kw)
1✔
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