ob-dj-store 0.0.12.1__py3-none-any.whl → 0.0.12.2__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 +26 -7
- {ob_dj_store-0.0.12.1.dist-info → ob_dj_store-0.0.12.2.dist-info}/METADATA +1 -1
- {ob_dj_store-0.0.12.1.dist-info → ob_dj_store-0.0.12.2.dist-info}/RECORD +5 -5
- {ob_dj_store-0.0.12.1.dist-info → ob_dj_store-0.0.12.2.dist-info}/WHEEL +0 -0
- {ob_dj_store-0.0.12.1.dist-info → ob_dj_store-0.0.12.2.dist-info}/top_level.txt +0 -0
@@ -970,15 +970,15 @@ class GenericSerializer(serializers.Serializer):
|
|
970
970
|
)
|
971
971
|
|
972
972
|
|
973
|
-
|
974
|
-
|
975
|
-
|
973
|
+
def get_favorite_extras_models():
|
974
|
+
extras_list = []
|
975
|
+
for key, value in settings.FAVORITE_TYPES.items():
|
976
|
+
if "extras" in value:
|
977
|
+
extras_list.extend(value["extras"].keys())
|
978
|
+
return extras_list
|
976
979
|
|
977
|
-
for key, value in settings.FAVORITE_TYPES.items():
|
978
|
-
if "extras" in value:
|
979
|
-
extras_list.extend(value["extras"].keys())
|
980
|
-
return extras_list
|
981
980
|
|
981
|
+
class FavoriteExtraSerializer(serializers.ModelSerializer):
|
982
982
|
content_object = GenericSerializer(read_only=True)
|
983
983
|
object_id = serializers.IntegerField(min_value=1, write_only=True)
|
984
984
|
object_type = serializers.ChoiceField(
|
@@ -994,6 +994,16 @@ class FavoriteExtraSerializer(serializers.ModelSerializer):
|
|
994
994
|
"object_type",
|
995
995
|
)
|
996
996
|
|
997
|
+
def to_representation(self, instance):
|
998
|
+
data = super().to_representation(instance)
|
999
|
+
extras = get_favorite_extras_models()
|
1000
|
+
model_name = instance.content_type.model
|
1001
|
+
for extra in extras:
|
1002
|
+
if model_name == extra.lower():
|
1003
|
+
data["object_type"] = extra
|
1004
|
+
break
|
1005
|
+
return data
|
1006
|
+
|
997
1007
|
|
998
1008
|
class FavoriteSerializer(serializers.ModelSerializer):
|
999
1009
|
content_object = GenericSerializer(read_only=True)
|
@@ -1017,6 +1027,15 @@ class FavoriteSerializer(serializers.ModelSerializer):
|
|
1017
1027
|
"name": {"required": True},
|
1018
1028
|
}
|
1019
1029
|
|
1030
|
+
def to_representation(self, instance):
|
1031
|
+
data = super().to_representation(instance)
|
1032
|
+
model_name = instance.content_type.model
|
1033
|
+
for favorite in store_settings.FAVORITE_TYPES.keys():
|
1034
|
+
if model_name == favorite.lower():
|
1035
|
+
data["object_type"] = favorite
|
1036
|
+
break
|
1037
|
+
return data
|
1038
|
+
|
1020
1039
|
def _lookup_validation(self, data):
|
1021
1040
|
content_type = ContentType.objects.get_for_model(data["content_object"])
|
1022
1041
|
queryset = Favorite.objects.filter(
|
@@ -3,7 +3,7 @@ ob_dj_store/apis/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
3
3
|
ob_dj_store/apis/stores/filters.py,sha256=18Sb8Id1mgCC0zAzTOQRfBaS7bkyD_sgM8_jAbf1ulE,6349
|
4
4
|
ob_dj_store/apis/stores/urls.py,sha256=cPForgFpOgOGCUVAk6DZcZ7qOooMf1zpDIr1BA0L_8A,1593
|
5
5
|
ob_dj_store/apis/stores/views.py,sha256=0MTOaEHAFR4nKKjOc_bdpo93sYHkp2JvkX7hRlK3GNs,31701
|
6
|
-
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=
|
6
|
+
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=b3Gka1WflitjxN6Gp-8BD1gKlCouQDZtrZOt2crFd38,38966
|
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
|
@@ -113,7 +113,7 @@ ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
113
113
|
ob_dj_store/utils/helpers.py,sha256=FtXXJOD2PILqZTyuf80bmf0KuWW64hxbJG6naJdxI5w,1607
|
114
114
|
ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
|
115
115
|
ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
|
116
|
-
ob_dj_store-0.0.12.
|
117
|
-
ob_dj_store-0.0.12.
|
118
|
-
ob_dj_store-0.0.12.
|
119
|
-
ob_dj_store-0.0.12.
|
116
|
+
ob_dj_store-0.0.12.2.dist-info/METADATA,sha256=ReVvSLpSZepJmFvkEIOo0tV9ZjtH9JoKpFvx3MDLg-Q,2827
|
117
|
+
ob_dj_store-0.0.12.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
118
|
+
ob_dj_store-0.0.12.2.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
|
119
|
+
ob_dj_store-0.0.12.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|