ob-dj-store 0.0.17.2__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")
93
-
89
+ data = super().to_representation(instance)
94
90
  if request and self.should_include_arabic_fields(request):
95
- for field_name in list(fields.keys()):
96
- if any(suffix in field_name for suffix in self.arabic_field_suffixes):
97
- original_field_name = field_name.replace("_arabic", "")
98
- fields[original_field_name] = fields[field_name]
99
- fields.pop(field_name, None)
100
-
101
- return fields
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):
@@ -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",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ob-dj-store
3
- Version: 0.0.17.2
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=7xTKzJf8MjYglC0M9XhILqkAcGhe1-dT57Wzxx7TT8k,59464
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
@@ -149,7 +149,7 @@ ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
149
149
  ob_dj_store/utils/helpers.py,sha256=o7wgypM7mI2vZqZKkhxnTcnHJC8GMQDOuYMnRwXr6tY,2058
150
150
  ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
151
151
  ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
152
- ob_dj_store-0.0.17.2.dist-info/METADATA,sha256=Hm-S7HrSI2ncvznCy8GZUSXXt0SI2gPZ-fOc5L_hOiY,2827
153
- ob_dj_store-0.0.17.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
154
- ob_dj_store-0.0.17.2.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
155
- ob_dj_store-0.0.17.2.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,,