ob-dj-store 0.0.12.8__py3-none-any.whl → 0.0.12.9__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.
@@ -845,9 +845,11 @@ class StoreSerializer(FavoriteMixin, serializers.ModelSerializer):
845
845
 
846
846
  def get_in_range_delivery(self, obj):
847
847
  user_location = self.context["request"].query_params.get("point")
848
- in_range_method = obj.shipping_methods.filter(
849
- type=ShippingMethod.ShippingType.DELIVERY
850
- ).exists()
848
+ in_range_method = False
849
+ for shipping_method in obj.shipping_methods.all():
850
+ if shipping_method.type == ShippingMethod.ShippingType.DELIVERY:
851
+ in_range_method = True
852
+ break
851
853
  if not in_range_method:
852
854
  return True
853
855
  if user_location and obj.poly:
@@ -900,9 +902,7 @@ class StoreSerializer(FavoriteMixin, serializers.ModelSerializer):
900
902
  return f"{ds}{unit}"
901
903
 
902
904
  def get_phone_contacts(self, obj):
903
- phone_contacts = obj.phone_contacts.filter(is_active=True).order_by(
904
- "-is_default"
905
- )
905
+ phone_contacts = obj.phone_contacts.all()
906
906
  return PhoneContactSerializer(phone_contacts, many=True).data
907
907
 
908
908
  def get_current_day_opening_hours(self, obj):
@@ -63,6 +63,7 @@ from ob_dj_store.core.stores.models import (
63
63
  Order,
64
64
  Payment,
65
65
  PaymentMethod,
66
+ PhoneContact,
66
67
  Product,
67
68
  ProductVariant,
68
69
  ShippingMethod,
@@ -100,8 +101,20 @@ class StoreView(
100
101
  return super(StoreView, self).get_permissions()
101
102
 
102
103
  def get_queryset(self):
103
- queryset = super().get_queryset()
104
- queryset = queryset.prefetch_related("opening_hours", "shipping_methods")
104
+ queryset = (
105
+ super()
106
+ .get_queryset()
107
+ .prefetch_related(
108
+ "shipping_methods",
109
+ "opening_hours",
110
+ Prefetch(
111
+ "phone_contacts",
112
+ queryset=PhoneContact.objects.filter(is_active=True).order_by(
113
+ "-is_default"
114
+ ),
115
+ ),
116
+ )
117
+ )
105
118
  if self.action == "favorites":
106
119
  favorite_store_ids = Favorite.objects.favorites_for_model(
107
120
  Store, self.request.user
@@ -261,6 +274,7 @@ class StoreView(
261
274
  "DELIVERED",
262
275
  ],
263
276
  )
277
+ .distinct()
264
278
  .count()
265
279
  )
266
280
  nearby_count = super().get_queryset().count()
@@ -1104,7 +1118,7 @@ class WalletViewSet(
1104
1118
  def transactions(
1105
1119
  self, request: Request, *args: typing.Any, **kwargs: typing.Any
1106
1120
  ) -> Response:
1107
- queryset = self.get_object().transactions.all()
1121
+ queryset = self.get_object().transactions.all().order_by("-created_at")
1108
1122
  page = self.paginate_queryset(queryset)
1109
1123
  if page is not None:
1110
1124
  serializer = self.get_serializer(page, many=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ob-dj-store
3
- Version: 0.0.12.8
3
+ Version: 0.0.12.9
4
4
  Summary: OBytes django application for managing ecommerce stores.
5
5
  Home-page: https://www.obytes.com/
6
6
  Author: OBytes
@@ -2,8 +2,8 @@ ob_dj_store/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
2
2
  ob_dj_store/apis/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  ob_dj_store/apis/stores/filters.py,sha256=PZiES6wknvHAVnrNcsU8gc4S_z3IE9hYttUbiwT0Ogg,6089
4
4
  ob_dj_store/apis/stores/urls.py,sha256=P4d0iamg2R5lTwc5DTIuhLzJTMSH4f5QpHzGR1_PWE0,1676
5
- ob_dj_store/apis/stores/views.py,sha256=Qn4AOjvvJjPI1v0gzQJjC7ie-L69hE6orceskd-sNDw,33842
6
- ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=Csc7WcnSvEr3aCY8VD3gozpY_-kvS1FRbDt8m0fKKDk,42831
5
+ ob_dj_store/apis/stores/views.py,sha256=RX540Bz4V3cT01Tu9Waxo9UvreDhElYg8aoJtQ0rAVY,34204
6
+ ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=TpOx-chOtbN6FWwVzkMpfDhUFYW_iL3xyZ-FAija10U,42869
7
7
  ob_dj_store/apis/tap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  ob_dj_store/apis/tap/serializers.py,sha256=KPrBK4h2-fWvEVf6vOj2ww5-USV9WqpyYicIqoHIiXI,1065
9
9
  ob_dj_store/apis/tap/urls.py,sha256=bnOTv6an11kxpo_FdqlhsizlGPLVpNxBjCyKcf3_C9M,367
@@ -116,7 +116,7 @@ ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
116
116
  ob_dj_store/utils/helpers.py,sha256=FtXXJOD2PILqZTyuf80bmf0KuWW64hxbJG6naJdxI5w,1607
117
117
  ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
118
118
  ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
119
- ob_dj_store-0.0.12.8.dist-info/METADATA,sha256=AOmaDt_XQTzZaeFcskG2_a-yxk4XQ5VbL1t4fuHjIGI,2827
120
- ob_dj_store-0.0.12.8.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
121
- ob_dj_store-0.0.12.8.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
122
- ob_dj_store-0.0.12.8.dist-info/RECORD,,
119
+ ob_dj_store-0.0.12.9.dist-info/METADATA,sha256=jMqketjE_fB6jZei-ESpv2iChAvvWBOAOX_PdHuPt_k,2827
120
+ ob_dj_store-0.0.12.9.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
121
+ ob_dj_store-0.0.12.9.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
122
+ ob_dj_store-0.0.12.9.dist-info/RECORD,,