great-components 2.6.4__py3-none-any.whl → 2.7.0__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.
- great_components/mixins.py +29 -0
- {great_components-2.6.4.dist-info → great_components-2.7.0.dist-info}/METADATA +46 -46
- {great_components-2.6.4.dist-info → great_components-2.7.0.dist-info}/RECORD +6 -6
- {great_components-2.6.4.dist-info → great_components-2.7.0.dist-info}/WHEEL +1 -1
- {great_components-2.6.4.dist-info → great_components-2.7.0.dist-info}/LICENSE +0 -0
- {great_components-2.6.4.dist-info → great_components-2.7.0.dist-info}/top_level.txt +0 -0
great_components/mixins.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
from django.conf import settings
|
2
2
|
from django.utils import translation
|
3
|
+
import requests
|
3
4
|
from great_components import helpers, forms
|
5
|
+
import uuid
|
4
6
|
|
5
7
|
|
6
8
|
class EnableTranslationsMixin:
|
@@ -73,10 +75,37 @@ class GA360Mixin:
|
|
73
75
|
if referer_url:
|
74
76
|
self.ga360_payload['referer_url'] = referer_url
|
75
77
|
|
78
|
+
def __send_to_ga4(self):
|
79
|
+
requests.post(
|
80
|
+
settings.GA4_API_URL,
|
81
|
+
params={
|
82
|
+
'api_secret': settings.GA4_API_SECRET,
|
83
|
+
'measurement_id': settings.GA4_MEASUREMENT_ID,
|
84
|
+
},
|
85
|
+
json={
|
86
|
+
'client_id': str(uuid.uuid4()),
|
87
|
+
'events': [{
|
88
|
+
'name': 'page_view',
|
89
|
+
'params': {
|
90
|
+
'page_id': self.ga360_payload.get('page_id'),
|
91
|
+
'business_unit': self.ga360_payload.get('business_unit'),
|
92
|
+
'site_section': self.ga360_payload.get('site_section'),
|
93
|
+
'site_subsection': self.ga360_payload.get('site_subsection'),
|
94
|
+
'referer_url': self.ga360_payload.get('referer_url'),
|
95
|
+
'login_status': self.ga360_payload.get('login_status'),
|
96
|
+
'user_id': self.ga360_payload.get('user_id'),
|
97
|
+
'site_language': self.ga360_payload.get('site_language'),
|
98
|
+
|
99
|
+
}
|
100
|
+
}],
|
101
|
+
},
|
102
|
+
)
|
103
|
+
|
76
104
|
def get_context_data(self, *args, **kwargs):
|
77
105
|
user = helpers.get_user(self.request)
|
78
106
|
is_logged_in = helpers.get_is_authenticated(self.request)
|
79
107
|
self.ga360_payload['login_status'] = is_logged_in
|
80
108
|
self.ga360_payload['user_id'] = user.hashed_uuid if (is_logged_in and not user.is_superuser) else None
|
81
109
|
self.ga360_payload['site_language'] = translation.get_language()
|
110
|
+
self.__send_to_ga4()
|
82
111
|
return super().get_context_data(ga360=self.ga360_payload, *args, **kwargs)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: great-components
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.7.0
|
4
4
|
Summary: Shared components library for Great services.
|
5
5
|
Home-page: https://github.com/uktrade/great-components
|
6
6
|
Author: DIT
|
@@ -23,54 +23,54 @@ Classifier: Programming Language :: Python :: 3.6
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.9
|
24
24
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
25
25
|
Description-Content-Type: text/markdown
|
26
|
-
Requires-Dist: django
|
27
|
-
Requires-Dist: beautifulsoup4
|
28
|
-
Requires-Dist: directory-constants
|
29
|
-
Requires-Dist: jsonschema
|
26
|
+
Requires-Dist: django<5.0,>=4.2.10
|
27
|
+
Requires-Dist: beautifulsoup4<5.0.0,>=4.6.0
|
28
|
+
Requires-Dist: directory-constants<25.0,>=24.1.1
|
29
|
+
Requires-Dist: jsonschema<4.0.0,>=3.0.1
|
30
30
|
Provides-Extra: demo
|
31
|
-
Requires-Dist: lorem
|
32
|
-
Requires-Dist: django-environ
|
33
|
-
Requires-Dist: gunicorn
|
34
|
-
Requires-Dist: whitenoise
|
35
|
-
Requires-Dist: django-pygments
|
31
|
+
Requires-Dist: lorem==0.1.1; extra == "demo"
|
32
|
+
Requires-Dist: django-environ==0.4.5; extra == "demo"
|
33
|
+
Requires-Dist: gunicorn==19.5.0; extra == "demo"
|
34
|
+
Requires-Dist: whitenoise==6.4.0; extra == "demo"
|
35
|
+
Requires-Dist: django-pygments==0.3.0; extra == "demo"
|
36
36
|
Provides-Extra: janitor
|
37
|
-
Requires-Dist: ansicolors
|
37
|
+
Requires-Dist: ansicolors<2.0.0,>=1.1.8; extra == "janitor"
|
38
38
|
Provides-Extra: test
|
39
|
-
Requires-Dist: lorem
|
40
|
-
Requires-Dist: ansicolors
|
41
|
-
Requires-Dist: gitdb
|
42
|
-
Requires-Dist: gitpython
|
43
|
-
Requires-Dist: GitPython
|
44
|
-
Requires-Dist: flake8
|
45
|
-
Requires-Dist: smmap
|
46
|
-
Requires-Dist: toml
|
47
|
-
Requires-Dist: requests-toolbelt
|
48
|
-
Requires-Dist: twine
|
49
|
-
Requires-Dist: wheel
|
50
|
-
Requires-Dist: setuptools
|
51
|
-
Requires-Dist: vulture
|
52
|
-
Requires-Dist: hvac
|
53
|
-
Requires-Dist: attrs
|
54
|
-
Requires-Dist: certifi
|
55
|
-
Requires-Dist: charset-normalizer
|
56
|
-
Requires-Dist: coverage[toml]
|
57
|
-
Requires-Dist: execnet
|
58
|
-
Requires-Dist: idna
|
59
|
-
Requires-Dist: iniconfig
|
60
|
-
Requires-Dist: packaging
|
61
|
-
Requires-Dist: pluggy
|
62
|
-
Requires-Dist: py
|
63
|
-
Requires-Dist: pytest
|
64
|
-
Requires-Dist: pytest-codecov
|
65
|
-
Requires-Dist: pytest-cov
|
66
|
-
Requires-Dist: pytest-django
|
67
|
-
Requires-Dist: pytest-sugar
|
68
|
-
Requires-Dist: pytest-xdist
|
69
|
-
Requires-Dist: requests
|
70
|
-
Requires-Dist: termcolor
|
71
|
-
Requires-Dist: tomli
|
72
|
-
Requires-Dist: urllib3
|
73
|
-
Requires-Dist: codecov
|
39
|
+
Requires-Dist: lorem==0.1.1; extra == "test"
|
40
|
+
Requires-Dist: ansicolors==1.1.8; extra == "test"
|
41
|
+
Requires-Dist: gitdb==4.0.10; extra == "test"
|
42
|
+
Requires-Dist: gitpython==3.1.31; extra == "test"
|
43
|
+
Requires-Dist: GitPython; extra == "test"
|
44
|
+
Requires-Dist: flake8==3.7.8; extra == "test"
|
45
|
+
Requires-Dist: smmap==5.0.0; extra == "test"
|
46
|
+
Requires-Dist: toml==0.10.2; extra == "test"
|
47
|
+
Requires-Dist: requests-toolbelt==0.8.0; extra == "test"
|
48
|
+
Requires-Dist: twine<2.0.0,>=1.11.0; extra == "test"
|
49
|
+
Requires-Dist: wheel<1.0.0,>=0.31.0; extra == "test"
|
50
|
+
Requires-Dist: setuptools<39.0.0,>=38.6.0; extra == "test"
|
51
|
+
Requires-Dist: vulture<2.0.0,>=1.0.0; extra == "test"
|
52
|
+
Requires-Dist: hvac<1.0.0,>=0.9.5; extra == "test"
|
53
|
+
Requires-Dist: attrs==23.1.0; extra == "test"
|
54
|
+
Requires-Dist: certifi==2022.12.7; extra == "test"
|
55
|
+
Requires-Dist: charset-normalizer==3.1.0; extra == "test"
|
56
|
+
Requires-Dist: coverage[toml]==7.2.5; extra == "test"
|
57
|
+
Requires-Dist: execnet==1.9.0; extra == "test"
|
58
|
+
Requires-Dist: idna==3.4; extra == "test"
|
59
|
+
Requires-Dist: iniconfig==2.0.0; extra == "test"
|
60
|
+
Requires-Dist: packaging==23.1; extra == "test"
|
61
|
+
Requires-Dist: pluggy==0.13.1; extra == "test"
|
62
|
+
Requires-Dist: py==1.11.0; extra == "test"
|
63
|
+
Requires-Dist: pytest==6.2.1; extra == "test"
|
64
|
+
Requires-Dist: pytest-codecov==0.5.1; extra == "test"
|
65
|
+
Requires-Dist: pytest-cov==4.0.0; extra == "test"
|
66
|
+
Requires-Dist: pytest-django==3.10.0; extra == "test"
|
67
|
+
Requires-Dist: pytest-sugar==0.9.7; extra == "test"
|
68
|
+
Requires-Dist: pytest-xdist==3.2.1; extra == "test"
|
69
|
+
Requires-Dist: requests==2.30.0; extra == "test"
|
70
|
+
Requires-Dist: termcolor==2.3.0; extra == "test"
|
71
|
+
Requires-Dist: tomli==2.0.1; extra == "test"
|
72
|
+
Requires-Dist: urllib3==1.26.15; extra == "test"
|
73
|
+
Requires-Dist: codecov; extra == "test"
|
74
74
|
|
75
75
|
# directory-components
|
76
76
|
|
@@ -7,7 +7,7 @@ great_components/context_processors.py,sha256=YkJPBLrrYnDYUHCpQP1shHommdj5NhgL-a
|
|
7
7
|
great_components/decorators.py,sha256=dgT0IxSN0uTlCSzsAdGU9NsR9hqouk0YPkNNzefRKtE,311
|
8
8
|
great_components/helpers.py,sha256=kOQqv4v2DSY5iKyseWnrMLawoa381GPRMgC7oHN3uCM,6908
|
9
9
|
great_components/middleware.py,sha256=9dVTTbMlTBnwcmDB3CDi6DGQrxiecOwY-Dg7lEOC_OQ,7361
|
10
|
-
great_components/mixins.py,sha256=
|
10
|
+
great_components/mixins.py,sha256=tKqzwunFOhuOulB_To12lKuavvz1GWtAOL3ua6xZuCM,4274
|
11
11
|
great_components/views.py,sha256=N2F6kvJUMmW9OQCIPcH16KMLlNhD_nrOTz_m0bnExZo,544
|
12
12
|
great_components/forms/__init__.py,sha256=hKKA3w8GBglzmszrK3-z3n8DSRBKcBe9_TLrC52YbLI,153
|
13
13
|
great_components/forms/fields.py,sha256=1N8hqFhVrZRgGIXDHzA8fH85XtI6B3ZyiWkZDXh0LOg,6044
|
@@ -634,8 +634,8 @@ great_components/templates/great_components/header_footer/search.html,sha256=SVU
|
|
634
634
|
great_components/templates/great_components/header_footer/sso_login.html,sha256=IasiMYwuaTDbwpwYa2gLJcEQRIqZcZHGCpeh7Awvw9M,463
|
635
635
|
great_components/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
636
636
|
great_components/templatetags/great_components.py,sha256=O_zVpOvZMHwhCpyq4JmmYu_iGwvaFsIP6lDn_ihtOVs,12173
|
637
|
-
great_components-2.
|
638
|
-
great_components-2.
|
639
|
-
great_components-2.
|
640
|
-
great_components-2.
|
641
|
-
great_components-2.
|
637
|
+
great_components-2.7.0.dist-info/LICENSE,sha256=q4QjlbTN37umB_xq3DRmS0qvT2tMO_5_-u0WWzYcDQE,1091
|
638
|
+
great_components-2.7.0.dist-info/METADATA,sha256=tZLZIVHPeuSoS5qwrIGryFkd7Mxh1n3cOPbnAOKIvyw,10545
|
639
|
+
great_components-2.7.0.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
640
|
+
great_components-2.7.0.dist-info/top_level.txt,sha256=aI2xcjZzpL8o3QuUGQB5YkqHOknVkFwQOSZQiaNqRHU,22
|
641
|
+
great_components-2.7.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|