ob-dj-store 0.0.20.2__py3-none-any.whl → 0.0.20.4__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 (60) hide show
  1. ob_dj_store/apis/stores/filters.py +5 -19
  2. ob_dj_store/apis/stores/rest/serializers/serializers.py +20 -34
  3. ob_dj_store/apis/stores/views.py +74 -226
  4. ob_dj_store/apis/tap/views.py +2 -6
  5. ob_dj_store/core/stores/admin.py +3 -21
  6. ob_dj_store/core/stores/admin_inlines.py +2 -7
  7. ob_dj_store/core/stores/gateway/tap/admin.py +1 -3
  8. ob_dj_store/core/stores/gateway/tap/managers.py +1 -6
  9. ob_dj_store/core/stores/gateway/tap/migrations/0001_initial.py +1 -3
  10. ob_dj_store/core/stores/gateway/tap/models.py +3 -12
  11. ob_dj_store/core/stores/gateway/tap/utils.py +2 -7
  12. ob_dj_store/core/stores/managers.py +1 -3
  13. ob_dj_store/core/stores/migrations/0001_initial.py +1 -4
  14. ob_dj_store/core/stores/migrations/0005_auto_20220425_2119.py +2 -5
  15. ob_dj_store/core/stores/migrations/0005_auto_20220427_1729.py +1 -2
  16. ob_dj_store/core/stores/migrations/0006_auto_20220428_0100.py +2 -8
  17. ob_dj_store/core/stores/migrations/0007_cart_cartitem_order_orderitem.py +2 -8
  18. ob_dj_store/core/stores/migrations/0010_auto_20220509_1633.py +1 -4
  19. ob_dj_store/core/stores/migrations/0012_auto_20220514_0633.py +1 -4
  20. ob_dj_store/core/stores/migrations/0013_auto_20220518_1539.py +1 -4
  21. ob_dj_store/core/stores/migrations/0014_auto_20220519_0018.py +3 -12
  22. ob_dj_store/core/stores/migrations/0017_auto_20220524_0912.py +3 -10
  23. ob_dj_store/core/stores/migrations/0018_auto_20220524_1613.py +1 -3
  24. ob_dj_store/core/stores/migrations/0021_auto_20220531_1849.py +1 -4
  25. ob_dj_store/core/stores/migrations/0026_auto_20220630_1913.py +8 -32
  26. ob_dj_store/core/stores/migrations/0031_auto_20220811_1733.py +1 -4
  27. ob_dj_store/core/stores/migrations/0033_auto_20220815_0133.py +2 -8
  28. ob_dj_store/core/stores/migrations/0039_auto_20220831_1521.py +1 -4
  29. ob_dj_store/core/stores/migrations/0044_remove_productvariant_has_inventory.py +1 -4
  30. ob_dj_store/core/stores/migrations/0049_auto_20221029_1524.py +2 -8
  31. ob_dj_store/core/stores/migrations/0050_favoriteextra.py +1 -3
  32. ob_dj_store/core/stores/migrations/0052_auto_20221129_1732.py +2 -8
  33. ob_dj_store/core/stores/migrations/0059_auto_20230217_2006.py +2 -8
  34. ob_dj_store/core/stores/migrations/0062_auto_20230226_2005.py +2 -6
  35. ob_dj_store/core/stores/migrations/0064_auto_20230228_1814.py +1 -2
  36. ob_dj_store/core/stores/migrations/0066_auto_20230304_1532.py +2 -8
  37. ob_dj_store/core/stores/migrations/0070_auto_20230323_1628.py +1 -4
  38. ob_dj_store/core/stores/migrations/0071_auto_20230328_1825.py +2 -5
  39. ob_dj_store/core/stores/migrations/0082_auto_20230613_1424.py +1 -4
  40. ob_dj_store/core/stores/migrations/0084_payment_result.py +1 -3
  41. ob_dj_store/core/stores/migrations/0087_auto_20230828_2138.py +1 -4
  42. ob_dj_store/core/stores/migrations/0097_auto_20231108_1939.py +1 -4
  43. ob_dj_store/core/stores/migrations/0100_remove_shippingmethod_type_arabic.py +1 -4
  44. ob_dj_store/core/stores/migrations/0106_alter_paymentmethod_payment_provider.py +35 -0
  45. ob_dj_store/core/stores/migrations/0107_auto_20250425_2059.py +29 -0
  46. ob_dj_store/core/stores/models/_address.py +1 -3
  47. ob_dj_store/core/stores/models/_cart.py +1 -3
  48. ob_dj_store/core/stores/models/_feedback.py +1 -3
  49. ob_dj_store/core/stores/models/_inventory.py +1 -2
  50. ob_dj_store/core/stores/models/_order.py +7 -20
  51. ob_dj_store/core/stores/models/_payment.py +3 -12
  52. ob_dj_store/core/stores/models/_product.py +5 -17
  53. ob_dj_store/core/stores/models/_store.py +5 -13
  54. ob_dj_store/core/stores/models/_wallet.py +7 -23
  55. ob_dj_store/core/stores/receivers.py +7 -20
  56. ob_dj_store/core/stores/utils.py +1 -2
  57. {ob_dj_store-0.0.20.2.dist-info → ob_dj_store-0.0.20.4.dist-info}/METADATA +3 -2
  58. {ob_dj_store-0.0.20.2.dist-info → ob_dj_store-0.0.20.4.dist-info}/RECORD +60 -58
  59. {ob_dj_store-0.0.20.2.dist-info → ob_dj_store-0.0.20.4.dist-info}/WHEEL +1 -1
  60. {ob_dj_store-0.0.20.2.dist-info → ob_dj_store-0.0.20.4.dist-info}/top_level.txt +0 -0
@@ -49,11 +49,7 @@ class StoreFilter(filters.FilterSet):
49
49
  return queryset.filter(address__country=value)
50
50
 
51
51
  def by_shipping_methods_names(self, queryset, name, value):
52
- return queryset.filter(
53
- shipping_methods__name__in=[
54
- value,
55
- ]
56
- )
52
+ return queryset.filter(shipping_methods__name__in=[value,])
57
53
 
58
54
  def by_open_stores(self, queryset, name, value):
59
55
  if value:
@@ -186,9 +182,7 @@ class CategoryFilter(filters.FilterSet):
186
182
 
187
183
  def by_type(self, queryset, name, value):
188
184
  return (
189
- queryset.filter(
190
- subcategories__products__type=value,
191
- )
185
+ queryset.filter(subcategories__products__type=value,)
192
186
  .prefetch_related(
193
187
  Prefetch(
194
188
  "subcategories",
@@ -198,9 +192,7 @@ class CategoryFilter(filters.FilterSet):
198
192
  ),
199
193
  Prefetch(
200
194
  "subcategories__products",
201
- queryset=Product.objects.filter(
202
- is_active=True,
203
- ).distinct(),
195
+ queryset=Product.objects.filter(is_active=True,).distinct(),
204
196
  ),
205
197
  )
206
198
  .distinct()
@@ -241,10 +233,7 @@ class FavoriteFilter(filters.FilterSet):
241
233
  product_variants__inventories__store__pk=value
242
234
  ).values_list("id", flat=True)
243
235
  content_type = ContentType.objects.get_for_model(Product)
244
- return queryset.filter(
245
- content_type=content_type,
246
- object_id__in=products_ids,
247
- )
236
+ return queryset.filter(content_type=content_type, object_id__in=products_ids,)
248
237
 
249
238
 
250
239
  class PaymentMethodFilter(filters.FilterSet):
@@ -267,10 +256,7 @@ class PaymentMethodFilter(filters.FilterSet):
267
256
 
268
257
  class WalletFilter(filters.FilterSet):
269
258
  currency = filters.CharFilter(
270
- method="by_currency",
271
- validators=[
272
- validate_currency,
273
- ],
259
+ method="by_currency", validators=[validate_currency,],
274
260
  )
275
261
  country = filters.CharFilter(method="by_country")
276
262
 
@@ -329,8 +329,7 @@ class OrderSerializer(serializers.ModelSerializer):
329
329
  return store
330
330
 
331
331
  def _validate_user_address(
332
- self,
333
- attrs,
332
+ self, attrs,
334
333
  ):
335
334
  if "shipping_address" not in attrs:
336
335
  raise ValidationError(
@@ -417,13 +416,9 @@ class OrderSerializer(serializers.ModelSerializer):
417
416
  logger.info(
418
417
  f"The fix for UAE stores timezone failed due to this error {e}"
419
418
  )
420
- if store.is_open_after_midnight:
421
- if to_hour < pickup_time_time < from_hour:
422
- raise serializers.ValidationError(
423
- _("Pickup time must be between store's opening hours")
424
- )
425
- elif (
426
- not op_hour.always_open
419
+ if (
420
+ op_hour.is_open_after_midnight
421
+ and not op_hour.always_open
427
422
  and pickup_time_time > to_hour
428
423
  or pickup_time_time < from_hour
429
424
  ):
@@ -736,9 +731,7 @@ class CartItemSerializer(
736
731
  "is_multi_variant",
737
732
  )
738
733
  extra_kwargs = {
739
- "store": {
740
- "required": True,
741
- },
734
+ "store": {"required": True,},
742
735
  }
743
736
 
744
737
  def get_is_multi_variant(self, obj):
@@ -779,9 +772,9 @@ class CartItemSerializer(
779
772
  favorites = Favorite.objects.favorites_for_object(
780
773
  obj.product_variant.product, user
781
774
  )
782
- customization = [
783
- obj.product_variant,
784
- ] + [attribute_choice for attribute_choice in obj.attribute_choices.all()]
775
+ customization = [obj.product_variant,] + [
776
+ attribute_choice for attribute_choice in obj.attribute_choices.all()
777
+ ]
785
778
  for favorite in favorites:
786
779
  content_objects = [
787
780
  instance.content_object for instance in favorite.extras.all()
@@ -1172,7 +1165,6 @@ class StoreSerializer(ArabicFieldsMixin, FavoriteMixin, serializers.ModelSeriali
1172
1165
  "image",
1173
1166
  "busy_mode",
1174
1167
  "name_arabic",
1175
- "is_open_after_midnight",
1176
1168
  )
1177
1169
  extra_kwargs = {
1178
1170
  "image": {"read_only": True, "required": False},
@@ -1186,16 +1178,16 @@ class StoreSerializer(ArabicFieldsMixin, FavoriteMixin, serializers.ModelSeriali
1186
1178
  if current_op_hour:
1187
1179
  from_hour = current_op_hour.from_hour
1188
1180
  to_hour = current_op_hour.to_hour
1189
- if current_time.tzinfo.zone != "Asia/Dubai":
1190
- if obj.currency == "AED":
1191
- try:
1192
- current_time += timedelta(hours=1)
1193
- except Exception as e:
1194
- logger.info(
1195
- f"The fix for UAE stores timezone failed due to this error {e}"
1196
- )
1197
-
1198
- if obj.is_open_after_midnight:
1181
+ # if current_time.tzinfo.zone != "Asia/Dubai":
1182
+ # if obj.currency == "AED":
1183
+ # try:
1184
+ # current_time += timedelta(hours=1)
1185
+ # except Exception as e:
1186
+ # logger.info(
1187
+ # f"The fix for UAE stores timezone failed due to this error {e}"
1188
+ # )
1189
+
1190
+ if current_op_hour.is_open_after_midnight:
1199
1191
  return True if to_hour < current_time.time() < from_hour else False
1200
1192
 
1201
1193
  if current_op_hour.always_open:
@@ -1817,9 +1809,7 @@ class PartnerAuthInfoSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
1817
1809
  status=OneTruePairing.Statuses.init,
1818
1810
  created_at__gte=timeout,
1819
1811
  ).get(
1820
- email=attrs["email"],
1821
- partner_otp_auth__partner=partner,
1822
- user=user,
1812
+ email=attrs["email"], partner_otp_auth__partner=partner, user=user,
1823
1813
  )
1824
1814
  self.context["otp"] = otp
1825
1815
  except ObjectDoesNotExist as e:
@@ -1856,11 +1846,7 @@ class PartnerAuthInfoSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
1856
1846
  otp.status = OneTruePairing.Statuses.used
1857
1847
  otp.save()
1858
1848
  partner_auth_info = PartnerAuthInfo.objects.update_or_create(
1859
- user=user,
1860
- defaults={
1861
- "partner": partner,
1862
- "email": validated_data["email"],
1863
- },
1849
+ user=user, defaults={"partner": partner, "email": validated_data["email"],},
1864
1850
  )
1865
1851
  return partner_auth_info
1866
1852