Баг фикс

main
through-your-tears 9 months ago
parent d13b12839c
commit 728e542d64

@ -24,7 +24,7 @@ class LocationSerializer(serializers.ModelSerializer):
class OrganizationListSerializer(serializers.ModelSerializer): class OrganizationListSerializer(serializers.ModelSerializer):
location = LocationSerializer() location = LocationSerializer()
images = serializers.StringRelatedField(many=True) images = serializers.StringRelatedField(source='image', many=True)
class Meta: class Meta:
model = Organization model = Organization
@ -33,7 +33,7 @@ class OrganizationListSerializer(serializers.ModelSerializer):
class OrganizationCreateSerializer(serializers.ModelSerializer): class OrganizationCreateSerializer(serializers.ModelSerializer):
location = LocationSerializer() location = LocationSerializer()
images = serializers.PrimaryKeyRelatedField(many=True, queryset=OrganizationImagesRepository) images = serializers.PrimaryKeyRelatedField(source='image', many=True, queryset=OrganizationImagesRepository)
owner = serializers.StringRelatedField() owner = serializers.StringRelatedField()
category = serializers.PrimaryKeyRelatedField(queryset=CategoryRepository.all()) category = serializers.PrimaryKeyRelatedField(queryset=CategoryRepository.all())

@ -11,5 +11,5 @@ urlpatterns = [
path('category/<int:id>/organizations/', OrganizationByCategoryListAPIView.as_view()), path('category/<int:id>/organizations/', OrganizationByCategoryListAPIView.as_view()),
path('search/<str:name>/', OrganizationSearchListAPIView.as_view()), path('search/<str:name>/', OrganizationSearchListAPIView.as_view()),
path('categories/', CategoryListAPIView.as_view()), path('categories/', CategoryListAPIView.as_view()),
path('upload/', UploadAPIView.as_view()) # path('upload/', UploadAPIView.as_view())
] + router.urls ] + router.urls

Loading…
Cancel
Save