utg-base 1.20.3__tar.gz → 1.21.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.
- {utg_base-1.20.3 → utg_base-1.21.0}/PKG-INFO +1 -1
- {utg_base-1.20.3 → utg_base-1.21.0}/pyproject.toml +1 -1
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/date.py +31 -1
- {utg_base-1.20.3 → utg_base-1.21.0}/README.md +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/api/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/api/base.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/api/pagination.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/api/permissions.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/api/routers.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/api/serializers.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/api/spectacular.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/authentications/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/authentications/microservice_authentication.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/authentications/models.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/apps.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/filters/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/filters/task_result.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/management/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/management/commands/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/management/commands/migrate_tasks.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/serializers/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/serializers/periodic_task.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/serializers/task_result.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/urls.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/views/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/views/periodic_task.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/views/task_result.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/constants/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/constants/accessibility_type.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/constants/available_languages.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/env.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/logging.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/middleware/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/middleware/debug.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/middleware/locale.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/migration/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/migration/apps.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/migration/management/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/migration/management/commands/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/migration/management/commands/makemigrations.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/models/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/models/jwt_user.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/models/timestamp.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/permissions/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/permissions/decorators.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/permissions/folder.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/permissions/utils.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/references_api/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/references_api/apps.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/references_api/migrations/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/references_api/urls.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/references_api/utils.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/services/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/services/base_api.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/signals/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/signals/sync_perms.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/u_services/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/u_services/apps.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/u_services/constants.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/u_services/migrations/0001_initial.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/u_services/migrations/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/u_services/models.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/u_services/u_requests.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/__init__.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/data.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/dict_util.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/response_processors.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/signals.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/sql.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/string.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/thread.py +0 -0
- {utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/utils/translation.py +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
from calendar import monthrange
|
|
2
2
|
from datetime import date, datetime, timedelta
|
|
3
3
|
|
|
4
|
+
from dateutil.relativedelta import relativedelta
|
|
5
|
+
from django.utils.timezone import make_aware as dj_make_aware
|
|
6
|
+
|
|
4
7
|
DEFAULT_DATE_FORMAT = '%Y-%m-%d'
|
|
5
8
|
DEFAULT_DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
|
|
6
9
|
|
|
@@ -23,6 +26,18 @@ class UDate(date):
|
|
|
23
26
|
def yesterday(self):
|
|
24
27
|
return to_udate(self.datetime() - timedelta(days=1))
|
|
25
28
|
|
|
29
|
+
def month_ago(self):
|
|
30
|
+
return self - relativedelta(months=1)
|
|
31
|
+
|
|
32
|
+
def month_later(self):
|
|
33
|
+
return self + relativedelta(months=1)
|
|
34
|
+
|
|
35
|
+
def year_ago(self):
|
|
36
|
+
return self - relativedelta(years=1)
|
|
37
|
+
|
|
38
|
+
def year_later(self):
|
|
39
|
+
return self + relativedelta(years=1)
|
|
40
|
+
|
|
26
41
|
def first_day_of_month(self):
|
|
27
42
|
return self.replace(day=1)
|
|
28
43
|
|
|
@@ -78,7 +93,7 @@ class UDateTime(datetime):
|
|
|
78
93
|
def last_second_of_day(self):
|
|
79
94
|
return self.last_second_of_hour().replace(hour=23)
|
|
80
95
|
|
|
81
|
-
def
|
|
96
|
+
def hour_later(self):
|
|
82
97
|
return self + timedelta(hours=1)
|
|
83
98
|
|
|
84
99
|
def hour_ago(self):
|
|
@@ -90,6 +105,18 @@ class UDateTime(datetime):
|
|
|
90
105
|
def yesterday(self):
|
|
91
106
|
return self - timedelta(days=1)
|
|
92
107
|
|
|
108
|
+
def month_ago(self):
|
|
109
|
+
return self - relativedelta(months=1)
|
|
110
|
+
|
|
111
|
+
def month_later(self):
|
|
112
|
+
return self + relativedelta(months=1)
|
|
113
|
+
|
|
114
|
+
def year_ago(self):
|
|
115
|
+
return self - relativedelta(years=1)
|
|
116
|
+
|
|
117
|
+
def year_later(self):
|
|
118
|
+
return self + relativedelta(years=1)
|
|
119
|
+
|
|
93
120
|
def first_day_of_month(self):
|
|
94
121
|
return self.replace(day=1)
|
|
95
122
|
|
|
@@ -118,6 +145,9 @@ class UDateTime(datetime):
|
|
|
118
145
|
def strftime(self, __format=DEFAULT_DATETIME_FORMAT):
|
|
119
146
|
return super().strftime(__format)
|
|
120
147
|
|
|
148
|
+
def make_aware(self) -> UDateTime:
|
|
149
|
+
return dj_make_aware(self)
|
|
150
|
+
|
|
121
151
|
@staticmethod
|
|
122
152
|
def strptime(__date_string: str, __format=DEFAULT_DATETIME_FORMAT):
|
|
123
153
|
return to_udatetime(datetime.strptime(__date_string, __format))
|
|
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
|
{utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/authentications/microservice_authentication.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/celery/management/commands/migrate_tasks.py
RENAMED
|
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
|
{utg_base-1.20.3 → utg_base-1.21.0}/src/utg_base/migration/management/commands/makemigrations.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|