{"id":18706,"date":"2022-06-15T13:18:32","date_gmt":"2022-06-15T10:18:32","guid":{"rendered":"https:\/\/mob25.com\/?p=18706"},"modified":"2023-05-09T21:47:51","modified_gmt":"2023-05-09T18:47:51","slug":"vjusety-i-routery-v-django","status":"publish","type":"post","link":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/","title":{"rendered":"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_87 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\"><\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#%D0%9F%D1%80%D0%B5%D0%B4%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BA%D0%BB%D0%B0%D1%81%D1%81_%D0%B4%D0%BB%D1%8F_%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D1%8B_%D1%81_%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D1%8F%D0%BC%D0%B8_Viewset\" >\u041f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438: Viewset<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#%D0%A3%D0%BD%D0%B8%D0%B2%D0%B5%D1%80%D1%81%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_ModelViewSet\" >\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 ModelViewSet<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#%D0%9A%D0%BB%D0%B0%D1%81%D1%81_ReadOnlyModelViewSet_%D1%82%D0%BE%D0%BB%D1%8C%D0%BA%D0%BE_%D1%87%D1%82%D0%B5%D0%BD%D0%B8%D0%B5\" >\u041a\u043b\u0430\u0441\u0441 ReadOnlyModelViewSet: \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#%D0%A0%D0%BE%D1%83%D1%82%D0%B5%D1%80%D1%8B\" >\u0420\u043e\u0443\u0442\u0435\u0440\u044b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#%D0%9F%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80_name_%D0%B2_%D1%8D%D0%BD%D0%B4%D0%BF%D0%BE%D0%B8%D0%BD%D1%82%D0%B0%D1%85\" >\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 name \u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u0445<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#SimpleRouter_vs_DefaultRouter\" >SimpleRouter vs DefaultRouter<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%9F%D1%80%D0%B5%D0%B4%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BA%D0%BB%D0%B0%D1%81%D1%81_%D0%B4%D0%BB%D1%8F_%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D1%8B_%D1%81_%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D1%8F%D0%BC%D0%B8_Viewset\"><\/span>\u041f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438: Viewset<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u0432\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u0442\u0438\u043f\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 CRUD, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430-\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430 \u0438 \u0434\u0432\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430. \u0428\u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u044b \u0432 \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0443\u0447\u0448\u0435.<\/p>\n\n\n\n<p>\u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c CRUD, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0410 \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435?<\/p>\n\n\n\n<p>\u0418 \u043a\u043e\u0433\u0434\u0430 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c&nbsp;<strong>\u0432\u044c\u044e\u0441\u0435\u0442\u044b<\/strong>.\u0412\u044c\u044e\u0441\u0435\u0442 (\u0430\u043d\u0433\u043b.&nbsp;<em>viewset<\/em>, \u00ab\u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439\u00bb) \u2014 \u044d\u0442\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 view-\u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 CRUD; \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n\n\n\n<p>\u0412\u043e \u0432\u044c\u044e\u0441\u0435\u0442\u044b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0438 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043e\u0448\u0438\u0431\u043e\u043a. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c: \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb.<\/p>\n\n\n\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435&nbsp;<code>rest_framework<\/code>&nbsp;\u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u044c\u044e\u0441\u0435\u0442\u043e\u0432, \u043e\u043d\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043f\u0430\u043a\u0435\u0442\u0435&nbsp;<code>viewsets<\/code>.<\/p>\n\n\n\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044c\u044e\u0441\u0435\u0442\u0430. \u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0439\u0442\u0435:&nbsp;<strong>ModelViewSet<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%A3%D0%BD%D0%B8%D0%B2%D0%B5%D1%80%D1%81%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_ModelViewSet\"><\/span>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 ModelViewSet<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u041a\u043b\u0430\u0441\u0441&nbsp;<strong>ModelViewSet<\/strong>&nbsp;\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 CRUD \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e. \u041e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438: \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b.\u0412 \u043a\u043b\u0430\u0441\u0441\u0435, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0441\u044f \u043e\u0442&nbsp;<code>ModelViewSet<\/code>, \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0434\u0432\u0430 \u043f\u043e\u043b\u044f:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0432 \u043f\u043e\u043b\u0435&nbsp;<code>queryset<\/code>&nbsp;\u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u044c\u044e\u0441\u0435\u0442;<\/li><li>\u0432 \u043f\u043e\u043b\u0435&nbsp;<code>serializer_class<\/code>&nbsp;\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u0430\u043a\u043e\u0439 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0451\u043d \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/li><\/ul>\n\n\n\n<p>\u0418 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c Kittygram: \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0432\u044c\u044e\u0441\u0435\u0442\u044b.\u042d\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430: \u0432\u043d\u043e\u0441\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 \u044d\u0442\u043e\u043c \u0443\u0440\u043e\u043a\u0435, \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 Kittygram, \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u044b\u0439 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435.\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442&nbsp;<code>viewsets<\/code>&nbsp;\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u043e\u0442&nbsp;<strong>ModelViewSet<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em># views.py<\/em>\nfrom rest_framework import viewsets \n\nfrom .models import Cat\nfrom .serializers import CatSerializer\n\n\nclass CatViewSet(viewsets.ModelViewSet):\n    queryset = Cat.objects.all()\n    serializer_class = CatSerializer <\/code><\/pre>\n\n\n\n<p>\u0412\u0441\u0451. \u041a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u0448\u0435\u0441\u0442\u044c \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0433\u043e\u0442\u043e\u0432.<\/p>\n\n\n\n<p>\u041a\u043b\u0430\u0441\u0441&nbsp;<code>ModelViewSet<\/code>&nbsp;\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb.<\/p>\n\n\n\n<p>\u0412\u044b\u0433\u043e\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%9A%D0%BB%D0%B0%D1%81%D1%81_ReadOnlyModelViewSet_%D1%82%D0%BE%D0%BB%D1%8C%D0%BA%D0%BE_%D1%87%D1%82%D0%B5%D0%BD%D0%B8%D0%B5\"><\/span>\u041a\u043b\u0430\u0441\u0441 ReadOnlyModelViewSet: \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u0412 \u043f\u0430\u043a\u0435\u0442\u0435 rest_framework.viewsets \u0435\u0441\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043d\u0430&nbsp;<code>ModelViewSet<\/code>, \u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0432 \u043f\u0440\u0430\u0432\u0430\u0445 \u043a\u043b\u0430\u0441\u0441&nbsp;<code>ReadOnlyModelViewSet<\/code>. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u2014 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442.<\/p>\n\n\n\n<p>\u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443, \u0431\u0435\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c&nbsp;<code>ReadOnlyModelViewSet<\/code>&nbsp;\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438&nbsp;<code>ModelViewSet<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%A0%D0%BE%D1%83%D1%82%D0%B5%D1%80%D1%8B\"><\/span>\u0420\u043e\u0443\u0442\u0435\u0440\u044b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 view-\u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0438 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432&nbsp;<em>urls.py<\/em>. \u041d\u043e \u0434\u043b\u044f \u0432\u044c\u044e\u0441\u0435\u0442\u043e\u0432 \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u2014&nbsp;<strong>\u0440\u043e\u0443\u0442\u0435\u0440\u044b<\/strong>&nbsp;(\u0430\u043d\u0433\u043b.&nbsp;<em>routers<\/em>).<\/p>\n\n\n\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044c\u044e\u0441\u0435\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u043f\u043e \u043c\u0430\u0441\u043a\u0435 \u0430\u0434\u0440\u0435\u0441\u0430:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>URL-\u043f\u0440\u0435\u0444\u0438\u043a\u0441\/<\/code>&nbsp;\u0438<\/li><li><code>URL-\u043f\u0440\u0435\u0444\u0438\u043a\u0441\/&lt;int:pk&gt;<\/code>.<\/li><\/ul>\n\n\n\n<p>\u0412 DRF \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u0430:&nbsp;<strong>SimpleRouter<\/strong>&nbsp;\u0438&nbsp;<strong>DefaultRouter<\/strong>. \u041e\u043d\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438, \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e.\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Kittygram. \u0412 \u0444\u0430\u0439\u043b&nbsp;<em>urls.py<\/em>&nbsp;\u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043a\u043b\u0430\u0441\u0441&nbsp;<code>SimpleRouter<\/code>&nbsp;\u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em># urls.py<\/em>\nfrom rest_framework.routers import SimpleRouter\n\nrouter = SimpleRouter() <\/code><\/pre>\n\n\n\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u043e\u0443\u0442\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 register() (\u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u00ab\u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b\u00bb). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 URL-\u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u044c\u044e\u0441\u0435\u0442\u0430, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>router.register('cats', CatViewSet) <\/code><\/pre>\n\n\n\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u0432 \u0441\u043f\u0438\u0441\u043e\u043a&nbsp;<code>urlpatterns<\/code>: \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432&nbsp;<code>router.urls<\/code>.<\/p>\n\n\n\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 router \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em># urls.py<\/em>\nfrom rest_framework.routers import SimpleRouter\n\nfrom django.urls import include, path\n\nfrom cats.views import CatViewSet\n\n<em># \u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0440\u043e\u0443\u0442\u0435\u0440<\/em>\nrouter = SimpleRouter()\n<em># \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 .register \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438<\/em>\nrouter.register('cats', CatViewSet)\n<em># \u0412 \u0440\u043e\u0443\u0442\u0435\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440 \"URL, viewset\":<\/em>\n<em># \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440<\/em>\n<em># router.register('owners', OwnerViewSet)<\/em>\n<em># \u041d\u043e \u043d\u0430\u043c \u044d\u0442\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e<\/em>\n\nurlpatterns = [\n    <em># \u0412\u0441\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 router \u043f\u0443\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 router.urls<\/em>\n    <em># \u0412\u043a\u043b\u044e\u0447\u0438\u043c \u0438\u0445 \u0432 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0439 urls.py<\/em>\n    path('', include(router.urls)),\n] <\/code><\/pre>\n\n\n\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u0432\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>cats\/<\/code>,<\/li><li><code>cats\/&lt;int:pk&gt;\/<\/code>.<\/li><\/ul>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u0438 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043b\u044e\u0431\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430&nbsp;<code>cats\/<\/code>&nbsp;\u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c.<\/li><li>\u0417\u0430\u043f\u0440\u043e\u0441\u044b PUT, PATCH \u0438\u043b\u0438 DELETE \u043a \u0430\u0434\u0440\u0435\u0441\u0443&nbsp;<code>cats\/&lt;pk&gt;\/<\/code>&nbsp;\u0438\u0437\u043c\u0435\u043d\u044f\u0442 \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c.<\/li><li>GET-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0442\u0435 \u0436\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432\u0435\u0440\u043d\u0451\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u043b\u0438 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%D0%9F%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80_name_%D0%B2_%D1%8D%D0%BD%D0%B4%D0%BF%D0%BE%D0%B8%D0%BD%D1%82%D0%B0%D1%85\"><\/span>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 name \u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u0445<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u0412&nbsp;<em>urls.py<\/em>&nbsp;\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440&nbsp;<code>name<\/code>. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d, \u0442\u043e \u0432\u043e view-\u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0438\u043b\u0438 view-\u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e&nbsp;<code>reverse()<\/code>&nbsp;\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 URL \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 DRY.<\/p>\n\n\n\n<p>\u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u044b \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u044d\u0442\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f Django-\u043f\u0440\u043e\u0435\u043a\u0442\u0430; \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 API&nbsp;<code>name<\/code>&nbsp;\u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u0445 \u0432\u0430\u043c \u0442\u043e\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f.<\/p>\n\n\n\n<p>\u0420\u043e\u0443\u0442\u0435\u0440\u044b \u0441\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442&nbsp;<code>name<\/code>&nbsp;\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430, \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0438\u0437 \u0438\u043c\u0435\u043d\u0438 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u044c\u044e\u0441\u0435\u0442,<\/li><li>\u0438 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430:<ul><li><em>-list<\/em>&nbsp;(\u0434\u043b\u044f \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432)<\/li><li>\u0438\u043b\u0438&nbsp;<em>-detail<\/em>&nbsp;(\u0434\u043b\u044f \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c).<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0432\u044c\u044e\u0441\u0435\u0442\u0430&nbsp;<code>CatViewSet()<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>class CatViewSet(viewsets.ModelViewSet):\n    queryset = Cat.objects.all()\n    serializer_class = CatSerializer <\/code><\/pre>\n\n\n\n<p>\u0438\u043c\u0435\u043d\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u0442\u0430\u043a\u0438\u043c\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>urlpatterns = [\n    <em># \u0417\u0434\u0435\u0441\u044c \u0438\u043c\u044f \"cat\" \u0432\u0437\u044f\u0442\u043e \u0438\u0437 queryset, <\/em>\n    <em># \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u044c\u044e\u0441\u0435\u0442 CatViewSet<\/em>\n    path('cat\/', ..., name='cat-list'),\n    path('cat\/&lt;int:pk&gt;\/', ..., name='cat-detail'),\n] <\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u044c\u044e\u0441\u0435\u0442\u0430\u043c\u0438 \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u0430\u043c\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u00ab\u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 basename\u00bb:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>'basename' argument not specified, and could not automatically determine the name from the viewset, as it does not have a '.queryset' attribute. <\/code><\/pre>\n\n\n\n<p>\u0420\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0435 \u0440\u043e\u0443\u0442\u0435\u0440\u0430&nbsp;<code>basename<\/code>: \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430&nbsp;<code>name<\/code>&nbsp;\u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u0445, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c.\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0440\u0435\u0444\u0438\u043a\u0441&nbsp;<em>cat<\/em>&nbsp;\u0432&nbsp;<code>name='cat-list'<\/code>&nbsp;\u0438&nbsp;<code>name='cat-detail'<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>router.register('cats', CatViewSet, basename='tiger') <\/code><\/pre>\n\n\n\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435&nbsp;<code>name<\/code>&nbsp;\u0434\u043b\u044f \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 tiger:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>urlpatterns = [\n    path('cat\/', ..., name='tiger-list'),\n    path('cat\/&lt;int:pk&gt;\/', ..., name='tiger-detail'),\n] <\/code><\/pre>\n\n\n\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440&nbsp;<code>basename<\/code>&nbsp;\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 queryset \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u043d\u0435 \u0437\u0430\u0434\u0430\u043d \u0432\u043e \u0432\u044c\u044e\u0441\u0435\u0442\u0435, \u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434&nbsp;<code>get_queryset()<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em># \u0415\u0441\u043b\u0438 \u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u043a\u043e\u0442\u0438\u043a\u0430\u043c, <\/em>\n<em># \u0442\u043e \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0431\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/em>\n<em># cats\/{cat_id}\/comments\/<\/em>\n\nclass CommentViewSet(viewsets.ModelViewSet):\n    serializer_class = CommentSerializer\n    <em># queryset \u0432\u043e \u0432\u044c\u044e\u0441\u0435\u0442\u0435 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c<\/em>\n    <em># \u041d\u0430\u043c \u0442\u0443\u0442 \u043d\u0443\u0436\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043e\u0442\u043e\u043c \u0441 id=cat_id<\/em>\n    <em># \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 get_queryset \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440<\/em>\n    def get_queryset(self):\n        <em># \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c id \u043a\u043e\u0442\u0438\u043a\u0430 \u0438\u0437 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430<\/em>\n        cat_id = self.kwargs.get(\"cat_id\")\n        <em># \u0418 \u043e\u0442\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438<\/em>\n        new_queryset = Comment.objects.filter(cat=cat_id)\n        return new_queryset <\/code><\/pre>\n\n\n\n<p>\u0412 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 \u0441\u043e\u0437\u0434\u0430\u0442\u044c&nbsp;<code>name<\/code>&nbsp;\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440&nbsp;<code>basename<\/code>&nbsp;\u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044f\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"SimpleRouter_vs_DefaultRouter\"><\/span>SimpleRouter vs DefaultRouter<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>DefaultRouter<\/strong>&nbsp;\u2014 \u044d\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f SimpleRouter: \u043e\u043d \u0443\u043c\u0435\u0435\u0442 \u0432\u0441\u0451 \u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0438 SimpleRouter, \u0430 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442&nbsp;<code>\/<\/code>, GET-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u0435\u0440\u043d\u0451\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0434\u043ec\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 API.\u0423 \u044d\u0442\u043e\u0433\u043e \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c&nbsp;<code>name<\/code>:&nbsp;<code>api-root<\/code>. \u041c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0433 \u0431\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>urlpatterns = [\n    ...\n    path('', ..., name='api-root'),\n] <\/code><\/pre>\n\n\n\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0451\u043d DefaultRouter, \u0442\u043e \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 GET-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0430\u0434\u0440\u0435\u0441\u0443&nbsp;http:\/\/127.0.0.1:8000\/&nbsp;\u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9.png\"><span itemprop=\"image\" itemscope itemtype=\"https:\/\/schema.org\/ImageObject\"><img itemprop=\"url image\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png\" alt=\"\" data-id=\"18707\" data-full-url=\"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9.png\" data-link=\"https:\/\/mob25.com\/?attachment_id=18707\" class=\"wp-image-18707\" srcset=\"https:\/\/mob25.com\/blog\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png 1024w, https:\/\/mob25.com\/blog\/wp-content\/uploads\/2021\/09\/api_9-300x200.png 300w, https:\/\/mob25.com\/blog\/wp-content\/uploads\/2021\/09\/api_9-768x512.png 768w, https:\/\/mob25.com\/blog\/wp-content\/uploads\/2021\/09\/api_9-1536x1024.png 1536w, https:\/\/mob25.com\/blog\/wp-content\/uploads\/2021\/09\/api_9.png 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><meta itemprop=\"width\" content=\"1024\"><meta itemprop=\"height\" content=\"682\"><\/span><\/a><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b API, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u043b\u0435\u0435 \u0432 \u043a\u0443\u0440\u0441\u0435 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441&nbsp;<strong>DefaultRouter<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438: Viewset \u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u0432\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u0442\u0438\u043f\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 CRUD, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430-\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430 \u0438 \u0434\u0432\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430. \u0428\u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u044b \u0432 \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0443\u0447\u0448\u0435. \u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c CRUD, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0410 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[187],"tags":[],"class_list":["post-18706","post","type-post","status-publish","format-standard","","category-uroki"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/\" \/>\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django\" \/>\n<meta property=\"og:description\" content=\"\u041f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438: Viewset \u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u0432\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u0442\u0438\u043f\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 CRUD, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430-\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430 \u0438 \u0434\u0432\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430. \u0428\u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u044b \u0432 \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0443\u0447\u0448\u0435. \u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c CRUD, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0410 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-15T10:18:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-09T18:47:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png\" \/>\n<meta name=\"author\" content=\"violet\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/\",\"url\":\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/\",\"name\":\"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django\",\"isPartOf\":{\"@id\":\"https:\/\/mob25.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png\",\"datePublished\":\"2022-06-15T10:18:32+00:00\",\"dateModified\":\"2023-05-09T18:47:51+00:00\",\"author\":{\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45\"},\"breadcrumb\":{\"@id\":\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#primaryimage\",\"url\":\"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png\",\"contentUrl\":\"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\/\/mob25.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mob25.com\/blog\/#website\",\"url\":\"https:\/\/mob25.com\/blog\/\",\"name\":\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mob25.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45\",\"name\":\"violet\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g\",\"caption\":\"violet\"},\"url\":\"https:\/\/mob25.com\/blog\/author\/nkl\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/","og_locale":"ru_RU","og_type":"article","og_title":"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django","og_description":"\u041f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438: Viewset \u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0443\u0440\u043e\u043a\u0435 \u0432\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u0442\u0438\u043f\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 CRUD, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430-\u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430 \u0438 \u0434\u0432\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430. \u0428\u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u044b \u0432 \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0443\u0447\u0448\u0435. \u0412\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c CRUD, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0438\u0437 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0410 [&hellip;]","og_url":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/","og_site_name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438","article_published_time":"2022-06-15T10:18:32+00:00","article_modified_time":"2023-05-09T18:47:51+00:00","og_image":[{"url":"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png","type":"","width":"","height":""}],"author":"violet","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/","url":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/","name":"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django","isPartOf":{"@id":"https:\/\/mob25.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#primaryimage"},"image":{"@id":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#primaryimage"},"thumbnailUrl":"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png","datePublished":"2022-06-15T10:18:32+00:00","dateModified":"2023-05-09T18:47:51+00:00","author":{"@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45"},"breadcrumb":{"@id":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/"]}]},{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#primaryimage","url":"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png","contentUrl":"https:\/\/mob25.com\/wp-content\/uploads\/2021\/09\/api_9-1024x682.png"},{"@type":"BreadcrumbList","@id":"https:\/\/mob25.com\/blog\/vjusety-i-routery-v-django\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/mob25.com\/blog\/"},{"@type":"ListItem","position":2,"name":"\u0412\u044c\u044e\u0441\u0435\u0442\u044b \u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u044b \u0432 Django"}]},{"@type":"WebSite","@id":"https:\/\/mob25.com\/blog\/#website","url":"https:\/\/mob25.com\/blog\/","name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mob25.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ru-RU"},{"@type":"Person","@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/493391ea0717532d228de3cda6d7cf45","name":"violet","image":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4571412769d757e8ecacdf5967ea55865839b6d95042f5fc535566d9d3533d0?s=96&d=mm&r=g","caption":"violet"},"url":"https:\/\/mob25.com\/blog\/author\/nkl\/"}]}},"_links":{"self":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts\/18706","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/comments?post=18706"}],"version-history":[{"count":0,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts\/18706\/revisions"}],"wp:attachment":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/media?parent=18706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/categories?post=18706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/tags?post=18706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}