epok-toolkit 1.8.2__tar.gz → 1.9.0__tar.gz
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.
Potentially problematic release.
This version of epok-toolkit might be problematic. Click here for more details.
- {epok_toolkit-1.8.2/epok_toolkit.egg-info → epok_toolkit-1.9.0}/PKG-INFO +3 -2
- epok_toolkit-1.9.0/README.md +4 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/django/manager.py +5 -5
- epok_toolkit-1.9.0/epok_toolkit/django/response.py +57 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0/epok_toolkit.egg-info}/PKG-INFO +3 -2
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit.egg-info/SOURCES.txt +1 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit.egg-info/requires.txt +1 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/pyproject.toml +2 -1
- epok_toolkit-1.8.2/README.md +0 -4
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/LICENSE +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/MANIFEST.in +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/__init__.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/apps.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/cache/__init__.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/cache/cacher.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/default_settings.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/django/__init__.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/django/fields.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/email/__init__.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/email/email_async.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/email/engine.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/email/templates.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/messaging/__init__.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/messaging/whatsapp.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/messaging/whatsapp_instanced.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/__init__.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/fuentes/Kollektif-Bold.ttf +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/fuentes/Kollektif-BoldItalic.ttf +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/fuentes/Kollektif-Italic.ttf +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/fuentes/Kollektif.ttf +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/plantillas/Ticket_congrats.png +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/plantillas/Ticket_congrats2.png +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit/pdf/ticket_pdf.py +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit.egg-info/dependency_links.txt +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/epok_toolkit.egg-info/top_level.txt +0 -0
- {epok_toolkit-1.8.2 → epok_toolkit-1.9.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: epok-toolkit
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Una herramienta para la gestión de tareas y procesos en Django con Celery.
|
|
5
5
|
Author-email: Fernando Leon Franco <fernanlee2131@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -12,6 +12,7 @@ Requires-Python: >=3.12.9
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: Django>=5.0.2
|
|
15
|
+
Requires-Dist: djangorestframework>=3.16.0
|
|
15
16
|
Requires-Dist: celery[redis]>=5.5.3
|
|
16
17
|
Requires-Dist: django-celery-beat>=2.6.0
|
|
17
18
|
Requires-Dist: colorstreak>=0.1.0
|
|
@@ -19,5 +20,5 @@ Dynamic: license-file
|
|
|
19
20
|
|
|
20
21
|
# EPOK Toolkit
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
Esta libreria contiene utilidades
|
|
23
24
|
|
|
@@ -14,11 +14,11 @@ class OptimizedManager(models.Manager):
|
|
|
14
14
|
"""
|
|
15
15
|
Custom manager for optimized querysets.
|
|
16
16
|
"""
|
|
17
|
-
def __init__(self,
|
|
17
|
+
def __init__(self, select_fields_full=None, prefetch_fields_full=None, select_fields_simple=None, prefetch_related_simple=None, *args, **kwargs):
|
|
18
18
|
|
|
19
19
|
super().__init__(*args, **kwargs)
|
|
20
|
-
self.
|
|
21
|
-
self.
|
|
20
|
+
self._select_fields_full = select_fields_full or []
|
|
21
|
+
self._prefetch_fields_full = prefetch_fields_full or []
|
|
22
22
|
self._select_fields_simple = select_fields_simple or []
|
|
23
23
|
self._prefetch_related_simple = prefetch_related_simple or []
|
|
24
24
|
|
|
@@ -27,8 +27,8 @@ class OptimizedManager(models.Manager):
|
|
|
27
27
|
|
|
28
28
|
def full(self):
|
|
29
29
|
return self.get_queryset().optimized(
|
|
30
|
-
select_fields=self.
|
|
31
|
-
prefetch_fields=self.
|
|
30
|
+
select_fields=self._select_fields_full,
|
|
31
|
+
prefetch_fields=self._prefetch_fields_full
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
def simple(self):
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from rest_framework.response import Response
|
|
2
|
+
from django.http import HttpResponse
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
STATUS_MESSAGES = {
|
|
7
|
+
200: "OK",
|
|
8
|
+
201: "Created",
|
|
9
|
+
202: "Accepted",
|
|
10
|
+
204: "No Content",
|
|
11
|
+
400: "Bad Request",
|
|
12
|
+
401: "Unauthorized",
|
|
13
|
+
403: "Forbidden",
|
|
14
|
+
404: "Not Found",
|
|
15
|
+
500: "Internal Server Error",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def response(data: Optional[dict] = None, status_code: int = 200, message: Optional[str] = None) -> Response:
|
|
21
|
+
success = True if 200 <= status_code < 300 else False
|
|
22
|
+
|
|
23
|
+
if status_code not in STATUS_MESSAGES:
|
|
24
|
+
raise ValueError(f"Invalid status code: {status_code}. Must be one of {list(STATUS_MESSAGES.keys())}.")
|
|
25
|
+
|
|
26
|
+
if status_code == 201 and not data:
|
|
27
|
+
raise ValueError("Data cannot be empty for status code 201 (Created).")
|
|
28
|
+
|
|
29
|
+
if status_code == 204 and data is not None:
|
|
30
|
+
raise ValueError("Data must be None for status code 204 (No Content).")
|
|
31
|
+
|
|
32
|
+
if not message:
|
|
33
|
+
message = STATUS_MESSAGES[status_code]
|
|
34
|
+
|
|
35
|
+
if not data:
|
|
36
|
+
data = {}
|
|
37
|
+
|
|
38
|
+
payload = {
|
|
39
|
+
"status": success,
|
|
40
|
+
"message": message
|
|
41
|
+
}
|
|
42
|
+
if success and data is not None:
|
|
43
|
+
payload["data"] = data
|
|
44
|
+
elif not success:
|
|
45
|
+
payload["error"] = data
|
|
46
|
+
return Response(payload, status=status_code)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def file_response(file: bytes, filename: str, content_type: str = "application/octet-stream", status_code: int = 200) -> HttpResponse:
|
|
51
|
+
"""
|
|
52
|
+
Returns a file response with the given file content, filename, and content type.
|
|
53
|
+
"""
|
|
54
|
+
response = HttpResponse(file, status=status_code)
|
|
55
|
+
response["Content-Disposition"] = f'attachment; filename="{filename}"'
|
|
56
|
+
response["Content-Type"] = content_type
|
|
57
|
+
return response
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: epok-toolkit
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Una herramienta para la gestión de tareas y procesos en Django con Celery.
|
|
5
5
|
Author-email: Fernando Leon Franco <fernanlee2131@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -12,6 +12,7 @@ Requires-Python: >=3.12.9
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: Django>=5.0.2
|
|
15
|
+
Requires-Dist: djangorestframework>=3.16.0
|
|
15
16
|
Requires-Dist: celery[redis]>=5.5.3
|
|
16
17
|
Requires-Dist: django-celery-beat>=2.6.0
|
|
17
18
|
Requires-Dist: colorstreak>=0.1.0
|
|
@@ -19,5 +20,5 @@ Dynamic: license-file
|
|
|
19
20
|
|
|
20
21
|
# EPOK Toolkit
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
Esta libreria contiene utilidades
|
|
23
24
|
|
|
@@ -15,6 +15,7 @@ epok_toolkit/cache/cacher.py
|
|
|
15
15
|
epok_toolkit/django/__init__.py
|
|
16
16
|
epok_toolkit/django/fields.py
|
|
17
17
|
epok_toolkit/django/manager.py
|
|
18
|
+
epok_toolkit/django/response.py
|
|
18
19
|
epok_toolkit/email/__init__.py
|
|
19
20
|
epok_toolkit/email/email_async.py
|
|
20
21
|
epok_toolkit/email/engine.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "epok-toolkit"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.9.0"
|
|
8
8
|
description = "Una herramienta para la gestión de tareas y procesos en Django con Celery."
|
|
9
9
|
authors = [
|
|
10
10
|
{ name="Fernando Leon Franco", email="fernanlee2131@gmail.com" }
|
|
@@ -20,6 +20,7 @@ classifiers = [
|
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
22
|
"Django>=5.0.2",
|
|
23
|
+
"djangorestframework>=3.16.0",
|
|
23
24
|
"celery[redis]>=5.5.3",
|
|
24
25
|
"django-celery-beat>=2.6.0",
|
|
25
26
|
"colorstreak>=0.1.0"
|
epok_toolkit-1.8.2/README.md
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|