ob-dj-store 0.0.17.2__py3-none-any.whl → 0.0.17.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.
- ob_dj_store/apis/stores/rest/serializers/serializers.py +44 -14
- ob_dj_store/core/stores/admin.py +1 -0
- ob_dj_store/core/stores/migrations/0100_remove_shippingmethod_type_arabic.py +17 -0
- ob_dj_store/core/stores/models/_store.py +0 -10
- {ob_dj_store-0.0.17.2.dist-info → ob_dj_store-0.0.17.4.dist-info}/METADATA +1 -1
- {ob_dj_store-0.0.17.2.dist-info → ob_dj_store-0.0.17.4.dist-info}/RECORD +8 -7
- {ob_dj_store-0.0.17.2.dist-info → ob_dj_store-0.0.17.4.dist-info}/WHEEL +0 -0
- {ob_dj_store-0.0.17.2.dist-info → ob_dj_store-0.0.17.4.dist-info}/top_level.txt +0 -0
@@ -84,21 +84,22 @@ class ArabicFieldsMixin:
|
|
84
84
|
language_header = request.META.get("HTTP_LANGUAGE", "").upper()
|
85
85
|
return language_header == self.ARABIC_LANGUAGE_CODE
|
86
86
|
|
87
|
-
def
|
88
|
-
"""
|
89
|
-
Override the get_fields method to include or exclude Arabic fields.
|
90
|
-
"""
|
91
|
-
fields = super().get_fields()
|
87
|
+
def to_representation(self, instance):
|
92
88
|
request = self.context.get("request")
|
93
|
-
|
89
|
+
data = super().to_representation(instance)
|
94
90
|
if request and self.should_include_arabic_fields(request):
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
91
|
+
data_output = {}
|
92
|
+
for field_name, field_instance in data.items():
|
93
|
+
for suffix in self.arabic_field_suffixes:
|
94
|
+
if field_name.endswith(suffix) or field_name.startswith(suffix):
|
95
|
+
original_field_name = field_name.replace(suffix, "")
|
96
|
+
data_output[original_field_name] = (
|
97
|
+
field_instance
|
98
|
+
if field_instance
|
99
|
+
else data[original_field_name]
|
100
|
+
)
|
101
|
+
data.update(data_output)
|
102
|
+
return data
|
102
103
|
|
103
104
|
|
104
105
|
class AttributeChoiceSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
@@ -107,7 +108,9 @@ class AttributeChoiceSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
107
108
|
fields = (
|
108
109
|
"id",
|
109
110
|
"name",
|
111
|
+
"name_arabic",
|
110
112
|
"label",
|
113
|
+
"label_arabic",
|
111
114
|
"is_default",
|
112
115
|
)
|
113
116
|
|
@@ -136,6 +139,7 @@ class AttributeSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
136
139
|
fields = (
|
137
140
|
"id",
|
138
141
|
"name",
|
142
|
+
"name_arabic",
|
139
143
|
"attribute_choices",
|
140
144
|
)
|
141
145
|
|
@@ -551,6 +555,7 @@ class ProductTagSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
551
555
|
fields = (
|
552
556
|
"id",
|
553
557
|
"name",
|
558
|
+
"name_arabic",
|
554
559
|
"text_color",
|
555
560
|
"background_color",
|
556
561
|
)
|
@@ -564,6 +569,7 @@ class ProductAttributeSerializer(ArabicFieldsMixin, serializers.ModelSerializer)
|
|
564
569
|
fields = (
|
565
570
|
"id",
|
566
571
|
"name",
|
572
|
+
"name_arabic",
|
567
573
|
"is_mandatory",
|
568
574
|
"attribute_choices",
|
569
575
|
"type",
|
@@ -577,13 +583,17 @@ class ProductVariantSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
577
583
|
product_attributes = ProductAttributeSerializer(many=True)
|
578
584
|
is_primary = serializers.SerializerMethodField()
|
579
585
|
inventory = serializers.SerializerMethodField()
|
586
|
+
name_extra = serializers.SerializerMethodField("get_name_extra")
|
580
587
|
|
581
588
|
class Meta:
|
582
589
|
model = ProductVariant
|
583
590
|
fields = (
|
584
591
|
"id",
|
592
|
+
"name_extra",
|
585
593
|
"name",
|
594
|
+
"name_arabic",
|
586
595
|
"label",
|
596
|
+
"label_arabic",
|
587
597
|
"sku",
|
588
598
|
"product_attributes",
|
589
599
|
"is_primary",
|
@@ -595,6 +605,9 @@ class ProductVariantSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
595
605
|
)
|
596
606
|
extra_kwargs = {"image_thumbnail_medium": {"read_only": True}}
|
597
607
|
|
608
|
+
def get_name_extra(self, obj):
|
609
|
+
return obj.name
|
610
|
+
|
598
611
|
def get_is_primary(self, obj):
|
599
612
|
return True if obj.inventories.filter(is_primary=True).exists() else False
|
600
613
|
|
@@ -821,6 +834,8 @@ class ProductSerializer(ArabicFieldsMixin, FavoriteMixin, serializers.ModelSeria
|
|
821
834
|
"product_variants",
|
822
835
|
"default_variant",
|
823
836
|
"favorites",
|
837
|
+
"name_arabic",
|
838
|
+
"description_arabic",
|
824
839
|
)
|
825
840
|
|
826
841
|
def to_representation(self, instance: Product):
|
@@ -837,9 +852,12 @@ class ProductListSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
837
852
|
fields = (
|
838
853
|
"id",
|
839
854
|
"name",
|
855
|
+
"name_arabic",
|
840
856
|
"slug",
|
841
857
|
"label",
|
858
|
+
"label_arabic",
|
842
859
|
"description",
|
860
|
+
"description_arabic",
|
843
861
|
"product_images",
|
844
862
|
"type",
|
845
863
|
)
|
@@ -856,7 +874,9 @@ class SubCategorySerializer(serializers.ModelSerializer):
|
|
856
874
|
fields = (
|
857
875
|
"id",
|
858
876
|
"name",
|
877
|
+
"name_arabic",
|
859
878
|
"description",
|
879
|
+
"description_arabic",
|
860
880
|
"is_active",
|
861
881
|
"products",
|
862
882
|
"image",
|
@@ -893,7 +913,9 @@ class CategorySerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
893
913
|
fields = (
|
894
914
|
"id",
|
895
915
|
"name",
|
916
|
+
"name_arabic",
|
896
917
|
"description",
|
918
|
+
"description_arabic",
|
897
919
|
"products",
|
898
920
|
"is_active",
|
899
921
|
"subcategories",
|
@@ -1046,6 +1068,7 @@ class StoreSerializer(ArabicFieldsMixin, FavoriteMixin, serializers.ModelSeriali
|
|
1046
1068
|
"current_day_opening_hours",
|
1047
1069
|
"image",
|
1048
1070
|
"busy_mode",
|
1071
|
+
"name_arabic",
|
1049
1072
|
)
|
1050
1073
|
extra_kwargs = {
|
1051
1074
|
"image": {"read_only": True, "required": False},
|
@@ -1123,7 +1146,10 @@ class StoreSerializer(ArabicFieldsMixin, FavoriteMixin, serializers.ModelSeriali
|
|
1123
1146
|
return len(self.favorites) > 0
|
1124
1147
|
|
1125
1148
|
def get_address_line(self, obj):
|
1126
|
-
|
1149
|
+
language = (
|
1150
|
+
True if self.context["request"].META.get("HTTP_LANGUAGE", "") else False
|
1151
|
+
)
|
1152
|
+
return obj.address.address_line_arabic if language else obj.address.address_line
|
1127
1153
|
|
1128
1154
|
def get_distance(self, obj):
|
1129
1155
|
# get the distance between the user location and store location
|
@@ -1166,7 +1192,9 @@ class PaymentMethodSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
1166
1192
|
"id",
|
1167
1193
|
"payment_provider",
|
1168
1194
|
"name",
|
1195
|
+
"name_arabic",
|
1169
1196
|
"description",
|
1197
|
+
"description_arabic",
|
1170
1198
|
)
|
1171
1199
|
|
1172
1200
|
|
@@ -1275,6 +1303,7 @@ class FavoriteSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
1275
1303
|
"extra_info",
|
1276
1304
|
"object_type",
|
1277
1305
|
"name",
|
1306
|
+
"name_arabic",
|
1278
1307
|
"is_available_in_store",
|
1279
1308
|
)
|
1280
1309
|
extra_kwargs = {
|
@@ -1438,6 +1467,7 @@ class WalletSerializer(ArabicFieldsMixin, serializers.ModelSerializer):
|
|
1438
1467
|
"currency",
|
1439
1468
|
"balance",
|
1440
1469
|
"name",
|
1470
|
+
"name_arabic",
|
1441
1471
|
"media_image",
|
1442
1472
|
"image_url",
|
1443
1473
|
]
|
ob_dj_store/core/stores/admin.py
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Generated by Django 3.2.8 on 2023-12-14 14:32
|
2
|
+
|
3
|
+
from django.db import migrations
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
("stores", "0099_alter_product_name_arabic"),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.RemoveField(
|
14
|
+
model_name="shippingmethod",
|
15
|
+
name="type_arabic",
|
16
|
+
),
|
17
|
+
]
|
@@ -29,11 +29,6 @@ class ShippingMethod(models.Model):
|
|
29
29
|
TAKEAWAY = "TAKEAWAY"
|
30
30
|
DELIVERY = "DELIVERY"
|
31
31
|
|
32
|
-
class ShippingTypeArabic(models.TextChoices):
|
33
|
-
DRIVE_THROUGH = "DRIVE_THROUGH"
|
34
|
-
TAKEAWAY = "TAKEAWAY"
|
35
|
-
DELIVERY = "توصيل"
|
36
|
-
|
37
32
|
class ShippingFeeOptions(models.IntegerChoices):
|
38
33
|
"""
|
39
34
|
Decides how the shipping fees should be calculated.
|
@@ -46,11 +41,6 @@ class ShippingMethod(models.Model):
|
|
46
41
|
type = models.CharField(
|
47
42
|
max_length=30, choices=ShippingType.choices, default=ShippingType.DELIVERY
|
48
43
|
)
|
49
|
-
type_arabic = models.CharField(
|
50
|
-
max_length=30,
|
51
|
-
choices=ShippingTypeArabic.choices,
|
52
|
-
default=ShippingTypeArabic.DELIVERY,
|
53
|
-
)
|
54
44
|
shipping_fee_option = models.IntegerField(
|
55
45
|
choices=ShippingFeeOptions.choices, default=1
|
56
46
|
)
|
@@ -3,14 +3,14 @@ ob_dj_store/apis/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
3
3
|
ob_dj_store/apis/stores/filters.py,sha256=lrtmusSkMSQZMrn4PYbwWwqDtPbWQc-nOXE3Wdl58ew,9676
|
4
4
|
ob_dj_store/apis/stores/urls.py,sha256=7vwogfIGcKS0hHYK3iBXKQwi1kCA_vuHY1eZt8rAspg,2021
|
5
5
|
ob_dj_store/apis/stores/views.py,sha256=wcTVpGOuRvYc0ADnu6niHPy_jcWKTYUTX9cJ7UAOWfE,43320
|
6
|
-
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=
|
6
|
+
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=2UdqUOvqtX1IozbT619VkSbLv5y87Zz2qlyU6NKsP1k,60564
|
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
|
10
10
|
ob_dj_store/apis/tap/views.py,sha256=VnVquybTHlJquxsC0RNTy20dtLXalchO0SlGjSDaBng,2666
|
11
11
|
ob_dj_store/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
12
|
ob_dj_store/core/stores/__init__.py,sha256=-izNGrxNn_nn3IQXd5pkuES9lSF-AHYb14yhNPozYCI,65
|
13
|
-
ob_dj_store/core/stores/admin.py,sha256=
|
13
|
+
ob_dj_store/core/stores/admin.py,sha256=VqTSIviohiX0OO39zr2HwZYFdxMWwV-mWdCYrbNc1IU,12322
|
14
14
|
ob_dj_store/core/stores/admin_inlines.py,sha256=NM8Ab7htloQdihRBmew4Ie-ENsKhMlKRIsIH06xO1Mw,2903
|
15
15
|
ob_dj_store/core/stores/apps.py,sha256=ZadmEER_dNcQTH617b3fAsYZJSyRw0g46Kjp4eOAsOU,498
|
16
16
|
ob_dj_store/core/stores/managers.py,sha256=Rhv_jTul29A0t_H7jiLQUewn4GnSbgYZ6kq4WAivvjc,9852
|
@@ -132,6 +132,7 @@ ob_dj_store/core/stores/migrations/0096_discount_discount_pos_id.py,sha256=UMK1y
|
|
132
132
|
ob_dj_store/core/stores/migrations/0097_auto_20231108_1939.py,sha256=zlz85pUO_3TynWIVcJfWESoapuffdY4aed8FQXhOF1s,1177
|
133
133
|
ob_dj_store/core/stores/migrations/0098_alter_discount_discount_rate.py,sha256=JkIwox2MiBxDtjvUZVHbF7zQZwL0JiejDglFf5lANGk,577
|
134
134
|
ob_dj_store/core/stores/migrations/0099_alter_product_name_arabic.py,sha256=dVv63A8f01zqA12KMWhV8Gu4brt8UYZ152TPk_aKiZw,483
|
135
|
+
ob_dj_store/core/stores/migrations/0100_remove_shippingmethod_type_arabic.py,sha256=3rwZhXsOqbo4jdW6AT5ClaDqXPYbMfP1JOesNzy-Ldw,347
|
135
136
|
ob_dj_store/core/stores/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
136
137
|
ob_dj_store/core/stores/models/__init__.py,sha256=VeWrDiIbw94ZDSFD-62rz9iTTW87iPdwDW5jcjxm7bs,2045
|
137
138
|
ob_dj_store/core/stores/models/_address.py,sha256=8zV444A8M7P8yqQHjEOCROUykWPQ1ndSdd2IIX8wwWY,2207
|
@@ -143,13 +144,13 @@ ob_dj_store/core/stores/models/_order.py,sha256=hFdlAQcN-iZM6_RaIWJ_FATwTER7pHCG
|
|
143
144
|
ob_dj_store/core/stores/models/_partner.py,sha256=n2D_tbhsry6QH3eFBMJyWTmv3Sd2iuKXBylIsjEU4fc,4470
|
144
145
|
ob_dj_store/core/stores/models/_payment.py,sha256=LLXDKDeetCWauybC_VCtxxnD1PECKvuzQcPrnTBh6fs,6434
|
145
146
|
ob_dj_store/core/stores/models/_product.py,sha256=F4GPoYXxmw-LC8Gben7RRFly-NmnjcvQhT6hrDggKbw,17665
|
146
|
-
ob_dj_store/core/stores/models/_store.py,sha256=
|
147
|
+
ob_dj_store/core/stores/models/_store.py,sha256=wv_bkWIpudUUcM81rLaOnuVzhBPMU5Dqk3oUmMY5Ep8,9581
|
147
148
|
ob_dj_store/core/stores/models/_wallet.py,sha256=Eb1Sy79_M8PGrcfd5Bri0fT-bkwyqfkPHNyC2T7CR_0,5454
|
148
149
|
ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
149
150
|
ob_dj_store/utils/helpers.py,sha256=o7wgypM7mI2vZqZKkhxnTcnHJC8GMQDOuYMnRwXr6tY,2058
|
150
151
|
ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
|
151
152
|
ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
|
152
|
-
ob_dj_store-0.0.17.
|
153
|
-
ob_dj_store-0.0.17.
|
154
|
-
ob_dj_store-0.0.17.
|
155
|
-
ob_dj_store-0.0.17.
|
153
|
+
ob_dj_store-0.0.17.4.dist-info/METADATA,sha256=ntqmx3kziaao3jAf57faWXBgL8ZRc8i6Oc8VDMfxDNY,2827
|
154
|
+
ob_dj_store-0.0.17.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
155
|
+
ob_dj_store-0.0.17.4.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
|
156
|
+
ob_dj_store-0.0.17.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|