wbcore 2.2.1__py2.py3-none-any.whl → 2.2.4__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. wbcore/contrib/agenda/locale/de/LC_MESSAGES/django.po +113 -0
  2. wbcore/contrib/agenda/static/agenda/markdown/documentation/building.md +11 -0
  3. wbcore/contrib/agenda/static/agenda/markdown/documentation/conferenceroom.md +20 -0
  4. wbcore/contrib/authentication/fixtures/authentication.json +62 -0
  5. wbcore/contrib/authentication/locale/de/LC_MESSAGES/django.po +610 -0
  6. wbcore/contrib/authentication/templates/activate_confirm.html +12 -0
  7. wbcore/contrib/authentication/templates/base.html +135 -0
  8. wbcore/contrib/authentication/templates/email_base_template.html +335 -0
  9. wbcore/contrib/authentication/templates/password_reset_done.html +13 -0
  10. wbcore/contrib/authentication/templates/password_reset_email.html +11 -0
  11. wbcore/contrib/authentication/templates/password_reset_email_html.html +43 -0
  12. wbcore/contrib/authentication/templates/password_reset_form.html +23 -0
  13. wbcore/contrib/authentication/templates/password_reset_sent.html +11 -0
  14. wbcore/contrib/authentication/templates/reset_password.html +15 -0
  15. wbcore/contrib/authentication/templates/user_registration_email.html +37 -0
  16. wbcore/contrib/color/admin.py +28 -0
  17. wbcore/contrib/color/apps.py +5 -0
  18. wbcore/contrib/color/enums.py +17 -0
  19. wbcore/contrib/color/factories.py +10 -0
  20. wbcore/contrib/color/fields.py +29 -0
  21. wbcore/contrib/color/forms.py +13 -0
  22. wbcore/contrib/color/models.py +62 -0
  23. wbcore/contrib/color/tests/conftest.py +10 -0
  24. wbcore/contrib/color/tests/test_color_models.py +61 -0
  25. wbcore/contrib/color/tests/test_fields.py +25 -0
  26. wbcore/contrib/currency/fixtures/currency.yaml +1014 -0
  27. wbcore/contrib/currency/fixtures/currency_fx_rate.yaml +73585 -0
  28. wbcore/contrib/directory/fixtures/directory.json +3924 -0
  29. wbcore/contrib/directory/locale/de/LC_MESSAGES/django.po +1686 -0
  30. wbcore/contrib/directory/static/directory/markdown/documentation/address.md +38 -0
  31. wbcore/contrib/directory/static/directory/markdown/documentation/banking.md +54 -0
  32. wbcore/contrib/directory/static/directory/markdown/documentation/bankingentry.md +38 -0
  33. wbcore/contrib/directory/static/directory/markdown/documentation/clientmanagerrelationship.md +42 -0
  34. wbcore/contrib/directory/static/directory/markdown/documentation/company.md +52 -0
  35. wbcore/contrib/directory/static/directory/markdown/documentation/companytype.md +2 -0
  36. wbcore/contrib/directory/static/directory/markdown/documentation/customerstatus.md +2 -0
  37. wbcore/contrib/directory/static/directory/markdown/documentation/email.md +20 -0
  38. wbcore/contrib/directory/static/directory/markdown/documentation/employeecompany.md +34 -0
  39. wbcore/contrib/directory/static/directory/markdown/documentation/employerperson.md +43 -0
  40. wbcore/contrib/directory/static/directory/markdown/documentation/person.md +61 -0
  41. wbcore/contrib/directory/static/directory/markdown/documentation/position.md +2 -0
  42. wbcore/contrib/directory/static/directory/markdown/documentation/relationshiptype.md +2 -0
  43. wbcore/contrib/directory/static/directory/markdown/documentation/socialmedia.md +23 -0
  44. wbcore/contrib/directory/static/directory/markdown/documentation/specialization.md +2 -0
  45. wbcore/contrib/directory/static/directory/markdown/documentation/systememployee.md +31 -0
  46. wbcore/contrib/directory/static/directory/markdown/documentation/telephone.md +23 -0
  47. wbcore/contrib/directory/static/directory/markdown/documentation/telephonesearch.md +26 -0
  48. wbcore/contrib/directory/static/directory/markdown/documentation/userisclient.md +14 -0
  49. wbcore/contrib/directory/static/directory/markdown/documentation/userismanager.md +28 -0
  50. wbcore/contrib/directory/static/directory/markdown/documentation/website.md +20 -0
  51. wbcore/contrib/documents/fixtures/docments.json +135 -0
  52. wbcore/contrib/documents/locale/de/LC_MESSAGES/django.po +272 -0
  53. wbcore/contrib/documents/static/documents/markdown/documentation/document_types.md +21 -0
  54. wbcore/contrib/documents/static/documents/markdown/documentation/documents.md +18 -0
  55. wbcore/contrib/documents/static/documents/markdown/documentation/shareablelink.md +28 -0
  56. wbcore/contrib/documents/static/documents/markdown/documentation/shareablelinkaccess.md +20 -0
  57. wbcore/contrib/documents/tests/conftest.py +30 -0
  58. wbcore/contrib/documents/tests/test_models.py +144 -0
  59. wbcore/contrib/example_app/fixtures/example_app.json +7425 -0
  60. wbcore/contrib/example_app/tests/test_models/test_event.py +87 -0
  61. wbcore/contrib/example_app/tests/test_models/test_match.py +210 -0
  62. wbcore/contrib/example_app/tests/test_models/test_others.py +159 -0
  63. wbcore/contrib/example_app/tests/test_serializers/test_league_serializer.py +34 -0
  64. wbcore/contrib/example_app/tests/test_serializers/test_match_serializer.py +134 -0
  65. wbcore/contrib/example_app/tests/test_serializers/test_role_serializer.py +13 -0
  66. wbcore/contrib/example_app/tests/test_serializers/test_sport_serializer.py +14 -0
  67. wbcore/contrib/example_app/tests/test_serializers/test_stadium_serializer.py +14 -0
  68. wbcore/contrib/example_app/tests/test_serializers/test_team_result_serializer.py +30 -0
  69. wbcore/contrib/example_app/tests/test_serializers/test_team_serializer.py +70 -0
  70. wbcore/contrib/example_app/tests/test_viewsets/test_event_viewset.py +162 -0
  71. wbcore/contrib/example_app/tests/test_viewsets/test_league_viewset.py +84 -0
  72. wbcore/contrib/example_app/tests/test_viewsets/test_match_viewset.py +65 -0
  73. wbcore/contrib/example_app/tests/test_viewsets/test_person_viewset.py +166 -0
  74. wbcore/contrib/example_app/tests/test_viewsets/test_role_viewset.py +75 -0
  75. wbcore/contrib/example_app/tests/test_viewsets/test_sport_viewset.py +75 -0
  76. wbcore/contrib/example_app/tests/test_viewsets/test_stadium_viewset.py +75 -0
  77. wbcore/contrib/example_app/tests/test_viewsets/test_team_viewset.py +92 -0
  78. wbcore/contrib/example_app/tests/test_viewsets/test_teamresult_viewset.py +58 -0
  79. wbcore/contrib/example_app/tests/test_viewsets/test_utils_viewsets.py +124 -0
  80. wbcore/contrib/geography/fixtures/geography.json +13454 -0
  81. wbcore/contrib/geography/static/geography/markdown/documentation/geography.md +16 -0
  82. wbcore/contrib/guardian/apps.py +6 -0
  83. wbcore/contrib/guardian/configurations.py +3 -0
  84. wbcore/contrib/guardian/filters.py +21 -0
  85. wbcore/contrib/guardian/tasks.py +10 -0
  86. wbcore/contrib/guardian/urls.py +12 -0
  87. wbcore/contrib/guardian/utils.py +124 -0
  88. wbcore/contrib/io/fixtures/io.json +145 -0
  89. wbcore/contrib/io/locale/de/LC_MESSAGES/django.po +52 -0
  90. wbcore/contrib/notifications/locale/de/LC_MESSAGES/django.po +60 -0
  91. wbcore/contrib/notifications/static/notifications/service-worker.js +1 -0
  92. wbcore/contrib/notifications/templates/notifications/notification_template.html +43 -0
  93. wbcore/contrib/notifications/viewsets/configs/notification_types.py +27 -0
  94. wbcore/contrib/notifications/viewsets/configs/notifications.py +85 -0
  95. wbcore/contrib/workflow/fixtures/workflow.json +612 -0
  96. wbcore/contrib/workflow/locale/de/LC_MESSAGES/django.po +1289 -0
  97. wbcore/contrib/workflow/static/workflow/markdown/documentation/assignedprocessstep.md +33 -0
  98. wbcore/contrib/workflow/static/workflow/markdown/documentation/condition.md +24 -0
  99. wbcore/contrib/workflow/static/workflow/markdown/documentation/decisionstep.md +30 -0
  100. wbcore/contrib/workflow/static/workflow/markdown/documentation/emailstep.md +45 -0
  101. wbcore/contrib/workflow/static/workflow/markdown/documentation/finishstep.md +33 -0
  102. wbcore/contrib/workflow/static/workflow/markdown/documentation/joinstep.md +33 -0
  103. wbcore/contrib/workflow/static/workflow/markdown/documentation/process.md +33 -0
  104. wbcore/contrib/workflow/static/workflow/markdown/documentation/processstep.md +51 -0
  105. wbcore/contrib/workflow/static/workflow/markdown/documentation/scriptstep.md +33 -0
  106. wbcore/contrib/workflow/static/workflow/markdown/documentation/splitstep.md +30 -0
  107. wbcore/contrib/workflow/static/workflow/markdown/documentation/startstep.md +27 -0
  108. wbcore/contrib/workflow/static/workflow/markdown/documentation/transition.md +27 -0
  109. wbcore/contrib/workflow/static/workflow/markdown/documentation/userstep.md +42 -0
  110. wbcore/contrib/workflow/static/workflow/markdown/documentation/workflow.md +32 -0
  111. wbcore/contrib/workflow/templates/Test_Templates.txt +25 -0
  112. wbcore/contrib/workflow/tests/test_models/step/test_decision_step.py +79 -0
  113. wbcore/contrib/workflow/tests/test_models/step/test_email_step.py +45 -0
  114. wbcore/contrib/workflow/tests/test_models/step/test_finish_step.py +105 -0
  115. wbcore/contrib/workflow/tests/test_models/step/test_join_step.py +127 -0
  116. wbcore/contrib/workflow/tests/test_models/step/test_script_step.py +24 -0
  117. wbcore/contrib/workflow/tests/test_models/step/test_split_step.py +49 -0
  118. wbcore/contrib/workflow/tests/test_models/step/test_step.py +621 -0
  119. wbcore/contrib/workflow/tests/test_models/step/test_user_step.py +225 -0
  120. wbcore/contrib/workflow/tests/test_models/test_condition.py +103 -0
  121. wbcore/contrib/workflow/tests/test_models/test_data.py +134 -0
  122. wbcore/contrib/workflow/tests/test_models/test_process.py +98 -0
  123. wbcore/contrib/workflow/tests/test_models/test_transition.py +128 -0
  124. wbcore/contrib/workflow/tests/test_models/test_workflow.py +358 -0
  125. wbcore/locale/de/LC_MESSAGES/django.po +667 -0
  126. wbcore/templates/errors/404.html +134 -0
  127. wbcore/templates/errors/500.html +138 -0
  128. wbcore/templates/errors/503.html +132 -0
  129. wbcore/templates/errors/custom.html +132 -0
  130. wbcore/templates/forms.py +0 -0
  131. wbcore/templates/notifications/email_template.html +43 -0
  132. wbcore/templates/wbcore/admin/change_list.html +8 -0
  133. wbcore/templates/wbcore/admin/csv_form.html +15 -0
  134. wbcore/templates/wbcore/dynamic_color_array.html +29 -0
  135. wbcore/templates/wbcore/email_base_template.html +335 -0
  136. wbcore/templates/wbcore/email_notification_template.html +10 -0
  137. wbcore/templates/wbcore/frontend.html +51 -0
  138. wbcore/test/e2e_helpers_methods/e2e_checks.py +121 -0
  139. wbcore/test/e2e_helpers_methods/e2e_helper_methods.py +395 -0
  140. wbcore/tests/test_permissions/test_backend.py +29 -0
  141. {wbcore-2.2.1.dist-info → wbcore-2.2.4.dist-info}/METADATA +1 -1
  142. {wbcore-2.2.1.dist-info → wbcore-2.2.4.dist-info}/RECORD +143 -3
  143. {wbcore-2.2.1.dist-info → wbcore-2.2.4.dist-info}/WHEEL +0 -0
@@ -0,0 +1,17 @@
1
+ from enum import Enum
2
+
3
+
4
+ class WBColor(Enum):
5
+ GREEN_LIGHT = "rgb(214, 229, 145)"
6
+ GREEN = "rgb(182, 223, 18)"
7
+ GREEN_DARK = "rgb(111, 181, 68)"
8
+ RED_LIGHT = "rgb(244, 132, 116)"
9
+ RED = "rgb(250, 84, 62)"
10
+ RED_DARK = "rgb(224, 57, 49)"
11
+ YELLOW_LIGHT = "rgb(247, 232, 113)"
12
+ YELLOW = "rgb(247, 207, 77)"
13
+ YELLOW_DARK = "rgb(247, 190, 47)"
14
+ GREY = "rgb(133, 144, 162)"
15
+ BLUE_LIGHT = "rgb(104, 198, 224)"
16
+ BLUE = "rgb(69, 112, 224)"
17
+ BLUE_DARK = "rgb(33, 26, 233)"
@@ -0,0 +1,10 @@
1
+ import factory
2
+ from wbcore.contrib.color.models import ColorGradient
3
+
4
+
5
+ class ColorGradientFactory(factory.django.DjangoModelFactory):
6
+ class Meta:
7
+ model = ColorGradient
8
+
9
+ title = factory.Sequence(lambda n: f"Color Gradient {n}")
10
+ colors = factory.List([factory.Faker("color") for _ in range(10)])
@@ -0,0 +1,29 @@
1
+ import re
2
+
3
+ from django.core.exceptions import ValidationError
4
+ from django.db.models import CharField
5
+
6
+
7
+ def validate_color(color_string):
8
+ """Hexadecimal validation."""
9
+ if color_string is None:
10
+ return color_string
11
+
12
+ if not re.search(r"^#(?:[0-9a-fA-F]{3}){1,2}$", color_string):
13
+ raise ValidationError("Please provide a valid hexadecimal color.")
14
+
15
+ return color_string
16
+
17
+
18
+ class ColorField(CharField):
19
+ description = "A field storing a hexadecimal color value"
20
+ default_validators = [validate_color]
21
+
22
+ def __init__(self, *args, **kwargs):
23
+ kwargs["max_length"] = 7
24
+ super().__init__(*args, **kwargs)
25
+
26
+ def deconstruct(self):
27
+ name, path, args, kwargs = super().deconstruct()
28
+ del kwargs["max_length"]
29
+ return name, path, args, kwargs
@@ -0,0 +1,13 @@
1
+ from django_better_admin_arrayfield.forms.widgets import DynamicArrayWidget
2
+
3
+
4
+ class DynamicArrayColorWidget(DynamicArrayWidget):
5
+ template_name = "wbcore/dynamic_color_array.html"
6
+
7
+ def get_context(self, name, value, attrs):
8
+ context = super().get_context(name, value, attrs)
9
+ context["default"] = "#ffffff"
10
+ return context
11
+
12
+ def __init__(self, *args, **kwargs):
13
+ super().__init__(*args, **kwargs)
@@ -0,0 +1,62 @@
1
+ from typing import Generator
2
+
3
+ from colorfield.fields import ColorField
4
+ from django.db import models
5
+ from django_better_admin_arrayfield.models.fields import ArrayField
6
+
7
+
8
+ class ColorGradient(models.Model):
9
+ """
10
+ Utility class for color gradient support in report
11
+ """
12
+
13
+ title = models.CharField(max_length=128, default="")
14
+ colors = ArrayField(ColorField(default="#FF0000"), default=list)
15
+
16
+ def __str__(self) -> str:
17
+ return self.title
18
+
19
+ def get_gradient(self, color: str | None = None, color_size: int = -1) -> Generator:
20
+ """
21
+ Return the consecutive colors (gradient) given a color based on the closest distance
22
+
23
+ Args:
24
+ color: a hex color. Optional.
25
+ color_size: The number of colors the list should return. Optional.
26
+
27
+ Returns:
28
+ A generator of colors bounds in size by the color_size parameters or the gradient defaults color palette size
29
+ """
30
+
31
+ def _hex2rgb(_color):
32
+ _color = _color.replace("#", "")
33
+ return tuple(int(_color[i : i + 2], 16) for i in (0, 2, 4))
34
+
35
+ if color_size < 0:
36
+ color_size = len(self.colors)
37
+
38
+ index = 0
39
+ if color:
40
+ color_rgb = _hex2rgb(color)
41
+ nearest_color = min(
42
+ self.colors, key=lambda subject: sum((s - q) ** 2 for s, q in zip(_hex2rgb(subject), color_rgb))
43
+ )
44
+
45
+ index = self.colors.index(nearest_color)
46
+ for i in range(color_size):
47
+ yield self.colors[(index + i) % len(self.colors)]
48
+
49
+
50
+ class TransparencyMixin:
51
+ def get_cell_formatting(self, request):
52
+ return [
53
+ {
54
+ "column": None,
55
+ "conditions": [
56
+ {
57
+ "condition": None,
58
+ "style": {"backgroundColor": f'rgba(255, 255, 255, {getattr(self, "TRANSPARENCY", 0.4)})'},
59
+ },
60
+ ],
61
+ }
62
+ ]
@@ -0,0 +1,10 @@
1
+ from django.apps import apps
2
+ from django.db.models.signals import pre_migrate
3
+ from pytest_factoryboy import register
4
+ from wbcore.contrib.color.factories import ColorGradientFactory
5
+ from wbcore.contrib.geography.tests.signals import app_pre_migration
6
+
7
+ register(ColorGradientFactory)
8
+
9
+
10
+ pre_migrate.connect(app_pre_migration, sender=apps.get_app_config("geography"))
@@ -0,0 +1,61 @@
1
+ import pytest
2
+ from wbcore.contrib.color.factories import ColorGradientFactory
3
+ from wbcore.contrib.color.models import ColorGradient
4
+
5
+ COLORS = ["#FFFFFF", "#000000", "#FF5733", "#3357FF", "#FF33A1", "#800080"]
6
+
7
+
8
+ class TestColorGradientModel:
9
+ @pytest.mark.django_db
10
+ def integration_test(self, mocker):
11
+ gradient = ColorGradientFactory()
12
+ assert ColorGradient.objects.filter(id=gradient.id).exists()
13
+
14
+ def test_str_method(self, mocker):
15
+ gradient = ColorGradient()
16
+ mocker.patch.object(gradient, "title", "My Gradient")
17
+ assert str(gradient) == "My Gradient"
18
+
19
+ def test_default_colors(self):
20
+ gradient = ColorGradient()
21
+ assert gradient.colors == []
22
+
23
+ def test_get_gradient(self, mocker):
24
+ gradient = ColorGradient()
25
+ assert list(gradient.get_gradient()) == []
26
+
27
+ def test_get_gradient_no_color_argument(self, mocker):
28
+ gradient = ColorGradient()
29
+ mocker.patch.object(gradient, "colors", COLORS)
30
+ palette = list(gradient.get_gradient(color=None, color_size=3))
31
+ assert len(palette) == 3
32
+
33
+ def test_get_gradient_with_non_existent_color(self, mocker):
34
+ gradient = ColorGradient()
35
+ mocker.patch.object(gradient, "colors", COLORS)
36
+ non_existent_color = "#123456"
37
+ palette = list(gradient.get_gradient(color=non_existent_color))
38
+ assert len(palette) == len(COLORS)
39
+ assert palette == ["#000000", "#FF5733", "#3357FF", "#FF33A1", "#800080", "#FFFFFF"]
40
+
41
+ @pytest.mark.parametrize("color_size", [20, 1, 0, -1])
42
+ def test_get_gradient_with_different_size(self, color_size, mocker):
43
+ gradient = ColorGradient()
44
+ mocker.patch.object(gradient, "colors", COLORS)
45
+ palette = list(gradient.get_gradient(color_size=color_size))
46
+ base_colors = gradient.colors
47
+ assert len(palette) == color_size if color_size > 0 else len(base_colors)
48
+ for index, color in enumerate(palette):
49
+ assert color == base_colors[index % len(base_colors)]
50
+
51
+ @pytest.mark.parametrize("color", COLORS)
52
+ def test_get_gradient_with_different_color(self, color, mocker):
53
+ gradient = ColorGradient()
54
+ mocker.patch.object(gradient, "colors", COLORS)
55
+ base_colors = gradient.colors
56
+
57
+ color_index = base_colors.index(color)
58
+ palette = list(gradient.get_gradient(color=color))
59
+
60
+ assert len(palette) == len(base_colors)
61
+ assert palette == base_colors[color_index:] + base_colors[:color_index]
@@ -0,0 +1,25 @@
1
+ import pytest
2
+ from django.core.exceptions import ValidationError
3
+ from wbcore.contrib.color.fields import validate_color
4
+
5
+
6
+ class TestColorield:
7
+ @pytest.mark.parametrize(
8
+ ("input", "valid"),
9
+ [
10
+ ("#1234567", False),
11
+ ("259868", False),
12
+ ("#25986", False),
13
+ ("", False),
14
+ ("#d225b0", True),
15
+ ("#4839a3", True),
16
+ ("#259868", True),
17
+ (None, True),
18
+ ],
19
+ )
20
+ def test_color_validator(self, input, valid):
21
+ if valid:
22
+ assert input == validate_color(input)
23
+ else:
24
+ with pytest.raises(ValidationError):
25
+ validate_color(input)