from django.urls import path # from news.api.views import ( # article_list_create_api_view, article_detail_api_view # ) from news.api.views import (ArticleListCreateAPIView, ArticleDetailAPIView, JournalistLCreateAPIView) urlpatterns = [ path('articles', ArticleListCreateAPIView.as_view(), name='article-list'), path('articles/<int:pk>', ArticleDetailAPIView.as_view(), name='article-detail'), path('journalists/', JournalistLCreateAPIView.as_view(), name='journalist-list'), # path('articles', article_list_create_api_view, name='article-list'), # path('articles/<int:pk>', article_detail_api_view, name='article-detail') ]
from django.urls import path #from news.api.views import article_detail_api_view, article_list_create_api_view from news.api.views import ArticleDetailAPIView, ArticleListCreateAPIView, JournalistListCreateAPIView urlpatterns = [ path("articles/", ArticleListCreateAPIView.as_view(), name="article-list"), path("articles/<int:pk>/", ArticleDetailAPIView.as_view(), name="article-detail"), path("journalists/", JournalistListCreateAPIView.as_view(), name="journalist-list") ]
from django.urls import path from news.api.views import article_list_create_api_view, article_detail_api_view, ArticleListCreateAPIView, \ ArticleDetailAPIView, JournalistListCreateAPIView urlpatterns = [ path("articles/", article_list_create_api_view, name="article-list"), path("articles/<int:pk>", article_detail_api_view, name="article-detail"), path("apiview/articles/", ArticleListCreateAPIView.as_view(), name="article-list-APIView"), path("apiview/articles/<int:pk>", ArticleDetailAPIView.as_view(), name="article-detail-APIView"), path("apiview/journalist/", JournalistListCreateAPIView.as_view(), name="journalist-list-APIView"), ]
from django.urls import path from news.api.views import (ArticleListCreateAPIView, ArticleDetailAPIView, JournalistCreateAPIView, JournalistDetailAPIView) urlpatterns = [ path('articles/', ArticleListCreateAPIView.as_view(), name="article_list"), path('articles/<int:pk>/', ArticleDetailAPIView.as_view(), name="article_detail"), path('journalists/', JournalistCreateAPIView.as_view(), name="journalist_list"), path('journalists/<int:pk>/', JournalistDetailAPIView.as_view(), name="journalist_detail"), ]
from django.urls import path from news.api.views import (article_list_create_api_view, ArticleDetailAPIView, article_detail_api_view, ArticleListCreateAPIView, JournalistListCreateAPIView) urlpatterns = [ path('class/articles/', ArticleListCreateAPIView.as_view(), name='class-article-list'), path('class/articles/<int:pk>/', ArticleDetailAPIView.as_view(), name='class-article-detail'), path('articles/', article_list_create_api_view, name='article-list'), path('articles/<int:pk>/', article_detail_api_view, name='article-detail'), path('class/journalists/', JournalistListCreateAPIView.as_view(), name='journalist-list'), ]
from django.urls import path from news.api.views import (article_list_create_api_view, article_detail_api_view, ArticleDetailAPIView, ArticleListCreateAPIView, JournalistListCreateAPIView) urlpatterns = [ # 1: function based API # path("articles/", article_list_create_api_view, name='article-list'), # path("articles/<int:pk>/", article_detail_api_view, name='article-detail'), # 2: class based API, it self has two model for its serializer # 2-1: defining a class which inherit serializer class and implementing all things by ourselves # 2-2: using ModelsSerializer which is very simple and less code needed path("articles/", ArticleListCreateAPIView.as_view(), name='articles-list'), path("articles/<int:pk>/", ArticleDetailAPIView.as_view(), name='article-detail'), path("journalists/", JournalistListCreateAPIView.as_view(), name='journalist-list'), ]
from django.urls import path from news.api.views import article_list_create_api_view, \ article_detail_api_view, ArticleListCreateAPIView, ArticleDetailAPIView, \ JournalistListCreateAPIView urlpatterns = [ path('articles/', article_list_create_api_view, name='article_list'), path('articles/<int:pk>', article_detail_api_view, name='article_detail'), path('articles/class/', ArticleListCreateAPIView.as_view(), name='article_list_class'), path('articles/class/<int:pk>', ArticleDetailAPIView.as_view(), name='article_detail_class'), path('journalists/class/', JournalistListCreateAPIView.as_view(), name='journalist_list_class'), ]