django-restit 4.2.135__py3-none-any.whl → 4.2.137__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- account/models/group.py +14 -14
- {django_restit-4.2.135.dist-info → django_restit-4.2.137.dist-info}/METADATA +1 -1
- {django_restit-4.2.135.dist-info → django_restit-4.2.137.dist-info}/RECORD +8 -8
- rest/__init__.py +1 -1
- rest/datem.py +15 -0
- rest/models/base.py +6 -0
- {django_restit-4.2.135.dist-info → django_restit-4.2.137.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.135.dist-info → django_restit-4.2.137.dist-info}/WHEEL +0 -0
account/models/group.py
CHANGED
@@ -134,6 +134,7 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
134
134
|
|
135
135
|
_tz_long = None
|
136
136
|
_tz_short = None
|
137
|
+
_eod_hour = None
|
137
138
|
|
138
139
|
@property
|
139
140
|
def timezone(self):
|
@@ -147,6 +148,12 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
147
148
|
self._tz_short = rh.getShortTZ(self.timezone)
|
148
149
|
return self._tz_short
|
149
150
|
|
151
|
+
@property
|
152
|
+
def end_of_day_hour(self):
|
153
|
+
if self._eod_hour is None:
|
154
|
+
self._eod_hour = self.getParentProperty("eod", 0, field_type=int)
|
155
|
+
return self._eod_hour
|
156
|
+
|
150
157
|
@property
|
151
158
|
def file_safe_name(self):
|
152
159
|
return re.sub("[^0-9a-zA-Z]+", "_", self.name.lower())
|
@@ -361,34 +368,27 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
361
368
|
return default
|
362
369
|
|
363
370
|
def getLocalTime(self, when=None, tz_aware=False):
|
364
|
-
|
365
|
-
return rh.convertToLocalTime(zone, when, tz_aware)
|
371
|
+
return rh.convertToLocalTime(self.timezone, when, tz_aware)
|
366
372
|
|
367
373
|
def getUTC(self, when):
|
368
|
-
|
369
|
-
return rh.convertToUTC(zone, when)
|
374
|
+
return rh.convertToUTC(self.timezone, when)
|
370
375
|
|
371
376
|
def getBusinessDay(self, start=None, end=None, kind="day"):
|
372
|
-
|
373
|
-
eod = self.getParentProperty("eod", 0, field_type=int)
|
374
|
-
return rh.getDateRange(start, end, kind, zone, hour=eod)
|
377
|
+
return rh.getDateRange(start, end, kind, self.timezone, hour=self.end_of_day_hour)
|
375
378
|
|
376
379
|
def getOperatingHours(self, start=None, end=None, kind="day"):
|
377
380
|
# deprecate this, operating hours is deceptive
|
378
|
-
|
379
|
-
eod = self.getParentProperty("eod", 0, field_type=int)
|
380
|
-
return rh.getDateRange(start, end, kind, zone, hour=eod)
|
381
|
+
return rh.getDateRange(start, end, kind, self.timezone, hour=self.end_of_day_hour)
|
381
382
|
|
382
383
|
def getTimeZoneOffset(self, when=None, hour=None):
|
383
|
-
|
384
|
-
return rh.getTimeZoneOffset(zone, when, hour=hour)
|
384
|
+
return rh.getTimeZoneOffset(self.timezone, when, hour=hour)
|
385
385
|
|
386
386
|
def getEOD(self, eod=None, onday=None, in_local=False):
|
387
387
|
if eod is None:
|
388
|
-
eod = self.
|
388
|
+
eod = self.end_of_day_hour
|
389
389
|
if in_local:
|
390
390
|
return eod
|
391
|
-
offset = self.getTimeZoneOffset(onday, hour=
|
391
|
+
offset = self.getTimeZoneOffset(onday, hour=self.end_of_day_hour)
|
392
392
|
return offset
|
393
393
|
|
394
394
|
def updateUUID(self):
|
@@ -28,7 +28,7 @@ account/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
28
28
|
account/models/__init__.py,sha256=cV_lMnT2vL_mjiYtT4hlcIHo52ocFbGSNVkOIHHLXZY,385
|
29
29
|
account/models/device.py,sha256=0AFeLMGk4im4KZVd3eGSyRbK4eQEXiFM2cdY8GUzihs,5934
|
30
30
|
account/models/feeds.py,sha256=vI7fG4ASY1M0Zjke24RdnfDcuWeATl_yR_25jPmT64g,2011
|
31
|
-
account/models/group.py,sha256=
|
31
|
+
account/models/group.py,sha256=N9Ow7AtV4xN5zSE9E5-msthJy0G5-3DEr2MTmvFO1kU,22887
|
32
32
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
33
33
|
account/models/member.py,sha256=FvVUoc_n7PgqxXduQRF-S4VJcl8aER5tMBxM5xsgswU,54682
|
34
34
|
account/models/membership.py,sha256=90EpAhOsGaqphDAkONP6j_qQ0OWSRaQsI8H7E7fgMkE,9249
|
@@ -377,14 +377,14 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
377
377
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
378
378
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
379
379
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
380
|
-
rest/__init__.py,sha256=
|
380
|
+
rest/__init__.py,sha256=PSWIfpDjtvbPEOyM64myB5msZj0BE25NqYDa501DmEs,122
|
381
381
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
382
382
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
383
383
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
384
384
|
rest/crypto/aes.py,sha256=NOVRBRSHCV-om68YpGySWWG-4kako3iEVjq8hxZWPUU,4372
|
385
385
|
rest/crypto/privpub.py,sha256=_FioylVcbMmDP80yPYjURmafEiDmEAMkskbc7WF10ac,4082
|
386
386
|
rest/crypto/util.py,sha256=agFN2OCPHC70tHNGWrMkkZX4Tt_Ty6imoKEMdTkZpKA,4514
|
387
|
-
rest/datem.py,sha256=
|
387
|
+
rest/datem.py,sha256=qbkgDpTVbxpnS4hRm_GnyRo9Gk7nRJbH-tJqxm172mo,13152
|
388
388
|
rest/decorators.py,sha256=AuB4agpog587CUsF8HkAZiHDfs_pueb2rdxXZD7dUUE,15327
|
389
389
|
rest/encryption.py,sha256=x6Kiez0tVqfxK26MSsRL3k8OS05ni1gEX2aj3I0S9V0,788
|
390
390
|
rest/errors.py,sha256=uKwG9OkLme36etabqK54DMjMQc1fgEoUIAUxXa7WFQw,612
|
@@ -410,7 +410,7 @@ rest/middleware/request.py,sha256=JchRNy5L-bGd-7h-KFYekGRvREe2eCkZXKOYqIkP2hI,41
|
|
410
410
|
rest/middleware/session.py,sha256=zHSoQpIzRLmpqr_JvW406wzpvU3W3gDbm5JhtzLAMlE,10240
|
411
411
|
rest/middleware/session_store.py,sha256=1nSdeXK8PyuYgGgIufqrS6j6QpIrQ7zbMNT0ol75e6U,1901
|
412
412
|
rest/models/__init__.py,sha256=M8pvFDq-WCF-QcM58X7pMufYYe0aaQ3U0PwGe9TKbbY,130
|
413
|
-
rest/models/base.py,sha256=
|
413
|
+
rest/models/base.py,sha256=soIYiW71wZdUPmYf-JPPcnHx79CrA9B-hGNFt_WlRCI,71609
|
414
414
|
rest/models/cacher.py,sha256=eKz8TINVhWEqKhJGMsRkKZTtBUIv5rN3NHbZwOC56Uk,578
|
415
415
|
rest/models/metadata.py,sha256=1nQ7CYo9bJHoaXE_hVNaj1-Y7yqhHlf2ZlaD1IfTzic,12904
|
416
416
|
rest/net.py,sha256=LcB2QV6VNRtsSdmiQvYZgwQUDwOPMn_VBdRiZ6OpI-I,2974
|
@@ -513,7 +513,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
513
513
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
514
514
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
515
515
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
516
|
-
django_restit-4.2.
|
517
|
-
django_restit-4.2.
|
518
|
-
django_restit-4.2.
|
519
|
-
django_restit-4.2.
|
516
|
+
django_restit-4.2.137.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
517
|
+
django_restit-4.2.137.dist-info/METADATA,sha256=kG5p8Bv4ZpfqyPukB-PQ6uzRwk-42-83MtyOIk70iRY,7663
|
518
|
+
django_restit-4.2.137.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
519
|
+
django_restit-4.2.137.dist-info/RECORD,,
|
rest/__init__.py
CHANGED
rest/datem.py
CHANGED
@@ -394,3 +394,18 @@ def convert_to_epoch_range(start, end=None):
|
|
394
394
|
raise ValueError("Start parameter must be an int, datetime object, or a string representing a timedelta.")
|
395
395
|
|
396
396
|
return start_epoch, end_epoch
|
397
|
+
|
398
|
+
|
399
|
+
def updateTimeFromString(dt, time_string):
|
400
|
+
# Check if the time_string is in "hour" format (e.g., "13") or
|
401
|
+
# "hour:minute" format (e.g., "1:32")
|
402
|
+
if ':' in time_string:
|
403
|
+
# Parse hour and minute
|
404
|
+
hour, minute = map(int, time_string.split(':'))
|
405
|
+
else:
|
406
|
+
# Only hour is provided
|
407
|
+
hour = int(time_string)
|
408
|
+
minute = 0
|
409
|
+
# Update the datetime object with the new hour and minute
|
410
|
+
updated_dt = dt.replace(hour=hour, minute=minute, second=0, microsecond=0)
|
411
|
+
return updated_dt
|
rest/models/base.py
CHANGED
@@ -1021,6 +1021,12 @@ class RestModel(object):
|
|
1021
1021
|
if dr_offset > 0:
|
1022
1022
|
dr_start = dr_start + timedelta(minutes=dr_offset)
|
1023
1023
|
dr_end = dr_end + timedelta(minutes=dr_offset)
|
1024
|
+
tr_start = request.DATA.get("tr_start")
|
1025
|
+
if tr_start is not None:
|
1026
|
+
tr_start = rh.updateTimeFromString(dr_start, tr_start)
|
1027
|
+
tr_end = request.DATA.get("tr_end")
|
1028
|
+
if tr_end is not None:
|
1029
|
+
tr_end = rh.updateTimeFromString(dr_end, tr_end)
|
1024
1030
|
dr_field = request.DATA.get("dr_field", getattr(cls.RestMeta, "DATE_RANGE_FIELD", "created"))
|
1025
1031
|
q = dict()
|
1026
1032
|
q["{}__gte".format(dr_field)] = dr_start
|
File without changes
|
File without changes
|