ob-dj-store 0.0.17.1__py3-none-any.whl → 0.0.17.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.
@@ -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 get_fields(self):
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")
89
+ data = super().to_representation(instance)
93
90
  if request and self.should_include_arabic_fields(request):
94
- for field_name in list(fields.keys()):
95
- # Check if the field has an Arabic version based on suffixes
91
+ data_output = {}
92
+ for field_name, field_instance in data.items():
96
93
  for suffix in self.arabic_field_suffixes:
97
94
  if field_name.endswith(suffix) or field_name.startswith(suffix):
98
- # Exclude the original field
99
95
  original_field_name = field_name.replace(suffix, "")
100
- fields.pop(original_field_name, None)
101
- return fields
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):
@@ -95,6 +95,7 @@ class StoreAdmin(LeafletGeoAdmin):
95
95
  {
96
96
  "fields": (
97
97
  "name",
98
+ "name_arabic",
98
99
  "location",
99
100
  "address",
100
101
  "is_active",
@@ -0,0 +1,20 @@
1
+ # Generated by Django 3.2.8 on 2023-12-11 11:31
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("stores", "0098_alter_discount_discount_rate"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterField(
14
+ model_name="product",
15
+ name="name_arabic",
16
+ field=models.CharField(
17
+ blank=True, help_text="Name in arabic", max_length=200, null=True
18
+ ),
19
+ ),
20
+ ]
@@ -199,7 +199,6 @@ class Product(DjangoModelCleanMixin, models.Model):
199
199
  null=True,
200
200
  blank=True,
201
201
  help_text=_("Name in arabic"),
202
- unique=True,
203
202
  )
204
203
  slug = models.SlugField(max_length=255, unique=True)
205
204
  label = models.CharField(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ob-dj-store
3
- Version: 0.0.17.1
3
+ Version: 0.0.17.3
4
4
  Summary: OBytes django application for managing ecommerce stores.
5
5
  Home-page: https://www.obytes.com/
6
6
  Author: OBytes
@@ -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=enqdUwDXp8pzA3oSyTLjs88BXFD0CGl1XFiu6Sht6jQ,59593
6
+ ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=if2fW9hSUU4JKJmcfestOCNfuCIzc06pPvUpQqZ9Pug,59639
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=t8n6oFsqFEgdhT3YJAQGmkgyrp217VGm3dx861Mbhz8,12287
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
@@ -131,6 +131,7 @@ ob_dj_store/core/stores/migrations/0095_auto_20231101_1531.py,sha256=a_xgTTK1FxH
131
131
  ob_dj_store/core/stores/migrations/0096_discount_discount_pos_id.py,sha256=UMK1yhbYho5JK5pvFSbAGuPU9nl9U2obBejeXlaoCxA,418
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
+ ob_dj_store/core/stores/migrations/0099_alter_product_name_arabic.py,sha256=dVv63A8f01zqA12KMWhV8Gu4brt8UYZ152TPk_aKiZw,483
134
135
  ob_dj_store/core/stores/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
135
136
  ob_dj_store/core/stores/models/__init__.py,sha256=VeWrDiIbw94ZDSFD-62rz9iTTW87iPdwDW5jcjxm7bs,2045
136
137
  ob_dj_store/core/stores/models/_address.py,sha256=8zV444A8M7P8yqQHjEOCROUykWPQ1ndSdd2IIX8wwWY,2207
@@ -141,14 +142,14 @@ ob_dj_store/core/stores/models/_inventory.py,sha256=ZU8xDMQZxLnFehkBEGWr-os4AF1I
141
142
  ob_dj_store/core/stores/models/_order.py,sha256=hFdlAQcN-iZM6_RaIWJ_FATwTER7pHCGoGSqc2prWBM,9710
142
143
  ob_dj_store/core/stores/models/_partner.py,sha256=n2D_tbhsry6QH3eFBMJyWTmv3Sd2iuKXBylIsjEU4fc,4470
143
144
  ob_dj_store/core/stores/models/_payment.py,sha256=LLXDKDeetCWauybC_VCtxxnD1PECKvuzQcPrnTBh6fs,6434
144
- ob_dj_store/core/stores/models/_product.py,sha256=HMuNcwCcbGLO0vlGM-23Kk83dCrVW_5ieKy0uqBkPhc,17686
145
+ ob_dj_store/core/stores/models/_product.py,sha256=F4GPoYXxmw-LC8Gben7RRFly-NmnjcvQhT6hrDggKbw,17665
145
146
  ob_dj_store/core/stores/models/_store.py,sha256=LmCdnkhuxMPC3oDAUXDlPuiTey_SWhGSLUnrG_9IToY,9888
146
147
  ob_dj_store/core/stores/models/_wallet.py,sha256=Eb1Sy79_M8PGrcfd5Bri0fT-bkwyqfkPHNyC2T7CR_0,5454
147
148
  ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
148
149
  ob_dj_store/utils/helpers.py,sha256=o7wgypM7mI2vZqZKkhxnTcnHJC8GMQDOuYMnRwXr6tY,2058
149
150
  ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
150
151
  ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
151
- ob_dj_store-0.0.17.1.dist-info/METADATA,sha256=RdDYTw1zMgd4B02G4exbvlMsb4_thMNujpPSyzQ0bEo,2827
152
- ob_dj_store-0.0.17.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
153
- ob_dj_store-0.0.17.1.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
154
- ob_dj_store-0.0.17.1.dist-info/RECORD,,
152
+ ob_dj_store-0.0.17.3.dist-info/METADATA,sha256=iD1ucE15Y-3JN0n9W3izZsw-7B80hXDuMlUJCL6SwP4,2827
153
+ ob_dj_store-0.0.17.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
154
+ ob_dj_store-0.0.17.3.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
155
+ ob_dj_store-0.0.17.3.dist-info/RECORD,,