ob-dj-store 0.0.20.1__py3-none-any.whl → 0.0.20.3__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/filters.py +5 -19
- ob_dj_store/apis/stores/rest/serializers/serializers.py +13 -17
- ob_dj_store/apis/stores/views.py +74 -226
- ob_dj_store/apis/tap/views.py +2 -6
- ob_dj_store/core/stores/admin.py +3 -20
- ob_dj_store/core/stores/admin_inlines.py +1 -7
- ob_dj_store/core/stores/gateway/tap/admin.py +1 -3
- ob_dj_store/core/stores/gateway/tap/managers.py +1 -6
- ob_dj_store/core/stores/gateway/tap/migrations/0001_initial.py +1 -3
- ob_dj_store/core/stores/gateway/tap/models.py +3 -12
- ob_dj_store/core/stores/gateway/tap/utils.py +2 -7
- ob_dj_store/core/stores/managers.py +1 -3
- ob_dj_store/core/stores/migrations/0001_initial.py +1 -4
- ob_dj_store/core/stores/migrations/0005_auto_20220425_2119.py +2 -5
- ob_dj_store/core/stores/migrations/0005_auto_20220427_1729.py +1 -2
- ob_dj_store/core/stores/migrations/0006_auto_20220428_0100.py +2 -8
- ob_dj_store/core/stores/migrations/0007_cart_cartitem_order_orderitem.py +2 -8
- ob_dj_store/core/stores/migrations/0010_auto_20220509_1633.py +1 -4
- ob_dj_store/core/stores/migrations/0012_auto_20220514_0633.py +1 -4
- ob_dj_store/core/stores/migrations/0013_auto_20220518_1539.py +1 -4
- ob_dj_store/core/stores/migrations/0014_auto_20220519_0018.py +3 -12
- ob_dj_store/core/stores/migrations/0017_auto_20220524_0912.py +3 -10
- ob_dj_store/core/stores/migrations/0018_auto_20220524_1613.py +1 -3
- ob_dj_store/core/stores/migrations/0021_auto_20220531_1849.py +1 -4
- ob_dj_store/core/stores/migrations/0026_auto_20220630_1913.py +8 -32
- ob_dj_store/core/stores/migrations/0031_auto_20220811_1733.py +1 -4
- ob_dj_store/core/stores/migrations/0033_auto_20220815_0133.py +2 -8
- ob_dj_store/core/stores/migrations/0039_auto_20220831_1521.py +1 -4
- ob_dj_store/core/stores/migrations/0044_remove_productvariant_has_inventory.py +1 -4
- ob_dj_store/core/stores/migrations/0049_auto_20221029_1524.py +2 -8
- ob_dj_store/core/stores/migrations/0050_favoriteextra.py +1 -3
- ob_dj_store/core/stores/migrations/0052_auto_20221129_1732.py +2 -8
- ob_dj_store/core/stores/migrations/0059_auto_20230217_2006.py +2 -8
- ob_dj_store/core/stores/migrations/0062_auto_20230226_2005.py +2 -6
- ob_dj_store/core/stores/migrations/0064_auto_20230228_1814.py +1 -2
- ob_dj_store/core/stores/migrations/0066_auto_20230304_1532.py +2 -8
- ob_dj_store/core/stores/migrations/0070_auto_20230323_1628.py +1 -4
- ob_dj_store/core/stores/migrations/0071_auto_20230328_1825.py +2 -5
- ob_dj_store/core/stores/migrations/0082_auto_20230613_1424.py +1 -4
- ob_dj_store/core/stores/migrations/0084_payment_result.py +1 -3
- ob_dj_store/core/stores/migrations/0087_auto_20230828_2138.py +1 -4
- ob_dj_store/core/stores/migrations/0097_auto_20231108_1939.py +1 -4
- ob_dj_store/core/stores/migrations/0100_remove_shippingmethod_type_arabic.py +1 -4
- ob_dj_store/core/stores/migrations/0106_alter_paymentmethod_payment_provider.py +35 -0
- ob_dj_store/core/stores/models/_address.py +1 -3
- ob_dj_store/core/stores/models/_cart.py +1 -3
- ob_dj_store/core/stores/models/_feedback.py +1 -3
- ob_dj_store/core/stores/models/_inventory.py +1 -2
- ob_dj_store/core/stores/models/_order.py +5 -19
- ob_dj_store/core/stores/models/_payment.py +3 -12
- ob_dj_store/core/stores/models/_product.py +4 -16
- ob_dj_store/core/stores/models/_store.py +3 -11
- ob_dj_store/core/stores/models/_wallet.py +7 -23
- ob_dj_store/core/stores/receivers.py +7 -20
- ob_dj_store/core/stores/utils.py +1 -2
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.3.dist-info}/METADATA +1 -1
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.3.dist-info}/RECORD +59 -58
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.3.dist-info}/WHEEL +1 -1
- {ob_dj_store-0.0.20.1.dist-info → ob_dj_store-0.0.20.3.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(
|
@@ -362,7 +361,7 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
362
361
|
raise serializers.ValidationError(errors)
|
363
362
|
email = gift_details.get("email")
|
364
363
|
phone_number = gift_details.get("phone_number")
|
365
|
-
|
364
|
+
user = self.context["request"].user
|
366
365
|
if email and phone_number:
|
367
366
|
raise serializers.ValidationError(
|
368
367
|
_("Both Email and Phone number cannot be provided.")
|
@@ -376,7 +375,12 @@ class OrderSerializer(serializers.ModelSerializer):
|
|
376
375
|
validate_email(email)
|
377
376
|
except ValidationError:
|
378
377
|
raise serializers.ValidationError(_("Invalid Email format."))
|
378
|
+
try:
|
379
|
+
if not gift_details["currency"]:
|
380
|
+
gift_details["currency"] = get_currency_by_country(user.country.code)
|
379
381
|
|
382
|
+
except Exception:
|
383
|
+
raise serializers.ValidationError("Currency is required")
|
380
384
|
if not pycountry.currencies.get(alpha_3=gift_details["currency"]):
|
381
385
|
raise serializers.ValidationError("Gift currency is not valid")
|
382
386
|
try:
|
@@ -731,9 +735,7 @@ class CartItemSerializer(
|
|
731
735
|
"is_multi_variant",
|
732
736
|
)
|
733
737
|
extra_kwargs = {
|
734
|
-
"store": {
|
735
|
-
"required": True,
|
736
|
-
},
|
738
|
+
"store": {"required": True,},
|
737
739
|
}
|
738
740
|
|
739
741
|
def get_is_multi_variant(self, obj):
|
@@ -774,9 +776,9 @@ class CartItemSerializer(
|
|
774
776
|
favorites = Favorite.objects.favorites_for_object(
|
775
777
|
obj.product_variant.product, user
|
776
778
|
)
|
777
|
-
customization = [
|
778
|
-
obj.
|
779
|
-
]
|
779
|
+
customization = [obj.product_variant,] + [
|
780
|
+
attribute_choice for attribute_choice in obj.attribute_choices.all()
|
781
|
+
]
|
780
782
|
for favorite in favorites:
|
781
783
|
content_objects = [
|
782
784
|
instance.content_object for instance in favorite.extras.all()
|
@@ -1812,9 +1814,7 @@ class PartnerAuthInfoSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
1812
1814
|
status=OneTruePairing.Statuses.init,
|
1813
1815
|
created_at__gte=timeout,
|
1814
1816
|
).get(
|
1815
|
-
email=attrs["email"],
|
1816
|
-
partner_otp_auth__partner=partner,
|
1817
|
-
user=user,
|
1817
|
+
email=attrs["email"], partner_otp_auth__partner=partner, user=user,
|
1818
1818
|
)
|
1819
1819
|
self.context["otp"] = otp
|
1820
1820
|
except ObjectDoesNotExist as e:
|
@@ -1851,11 +1851,7 @@ class PartnerAuthInfoSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
1851
1851
|
otp.status = OneTruePairing.Statuses.used
|
1852
1852
|
otp.save()
|
1853
1853
|
partner_auth_info = PartnerAuthInfo.objects.update_or_create(
|
1854
|
-
user=user,
|
1855
|
-
defaults={
|
1856
|
-
"partner": partner,
|
1857
|
-
"email": validated_data["email"],
|
1858
|
-
},
|
1854
|
+
user=user, defaults={"partner": partner, "email": validated_data["email"],},
|
1859
1855
|
)
|
1860
1856
|
return partner_auth_info
|
1861
1857
|
|