uncommented endpoints for create/update/delete news app

This commit is contained in:
Anatoly 2019-08-26 13:06:33 +03:00
parent 610ecb6f35
commit 6ac20fc4b2
3 changed files with 7 additions and 6 deletions

View File

@ -72,7 +72,6 @@ class Collection(ProjectBaseMixin, CollectionNameMixin,
return f'{self.name}'
class CollectionItemQuerySet(models.QuerySet):
"""QuerySet for model CollectionItem."""

View File

@ -50,6 +50,7 @@ class NewsCreateUpdateSerializer(NewsSerializer):
title = serializers.JSONField()
subtitle = serializers.JSONField()
description = serializers.JSONField()
image = serializers.ImageField(required=True)
news_type = serializers.PrimaryKeyRelatedField(
queryset=models.NewsType.objects.all(), write_only=True)
address = serializers.PrimaryKeyRelatedField(
@ -69,5 +70,6 @@ class NewsCreateUpdateSerializer(NewsSerializer):
'start',
'end',
'playlist',
'address'
'address',
'image',
]

View File

@ -7,9 +7,9 @@ app_name = 'news'
urlpatterns = [
path('', common.NewsList.as_view(), name='news_list'),
# path('create/', common.NewsCreate.as_view(), name='news_create'),
# path('<int:pk>/', common.NewsDetail.as_view(), name='news_detail'),
# path('<int:pk>/update/', common.NewsUpdate.as_view(), name='news_update'),
# path('<int:pk>/delete/', common.NewsDelete.as_view(), name='news_delete'),
path('create/', common.NewsCreate.as_view(), name='news_create'),
path('<int:pk>/', common.NewsDetail.as_view(), name='news_detail'),
path('<int:pk>/update/', common.NewsUpdate.as_view(), name='news_update'),
path('<int:pk>/delete/', common.NewsDelete.as_view(), name='news_delete'),
path('type/', common.NewsTypeList.as_view(), name='news_type'),
]