ob-dj-store 0.0.12.7__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.
- ob_dj_store/apis/stores/rest/serializers/serializers.py +6 -6
- ob_dj_store/apis/stores/views.py +19 -5
- {ob_dj_store-0.0.12.7.dist-info → ob_dj_store-0.0.12.9.dist-info}/METADATA +1 -1
- {ob_dj_store-0.0.12.7.dist-info → ob_dj_store-0.0.12.9.dist-info}/RECORD +6 -6
- {ob_dj_store-0.0.12.7.dist-info → ob_dj_store-0.0.12.9.dist-info}/WHEEL +0 -0
- {ob_dj_store-0.0.12.7.dist-info → ob_dj_store-0.0.12.9.dist-info}/top_level.txt +0 -0
@@ -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 =
|
849
|
-
|
850
|
-
|
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.
|
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):
|
ob_dj_store/apis/stores/views.py
CHANGED
@@ -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 =
|
104
|
-
|
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()
|
@@ -572,7 +586,7 @@ class ProductView(
|
|
572
586
|
inventories__store__pk=self.kwargs["store_pk"]
|
573
587
|
).distinct(),
|
574
588
|
),
|
575
|
-
)
|
589
|
+
).distinct()
|
576
590
|
|
577
591
|
def get_queryset(self):
|
578
592
|
queryset = super().get_queryset()
|
@@ -583,7 +597,7 @@ class ProductView(
|
|
583
597
|
|
584
598
|
queryset = self.queryset.filter(pk__in=favorite_product_ids)
|
585
599
|
queryset = self.apply_prefetch(queryset)
|
586
|
-
return queryset
|
600
|
+
return queryset
|
587
601
|
|
588
602
|
def get_object(self):
|
589
603
|
queryset = super().get_queryset()
|
@@ -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)
|
@@ -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=
|
6
|
-
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=
|
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.
|
120
|
-
ob_dj_store-0.0.12.
|
121
|
-
ob_dj_store-0.0.12.
|
122
|
-
ob_dj_store-0.0.12.
|
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,,
|
File without changes
|
File without changes
|