2018-10-06 12:43:14 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" / > < meta name = "generator" content = "Docutils 0.18.1: http://docutils.sourceforge.net/" / >
< title > Adding Django Rest framework API endpoint — Django Categories 1.9.1 documentation< / title >
< script >
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";
< / script >
<!-- Loaded before other Sphinx assets -->
< link href = "_static/styles/theme.css?digest=9b1a4fa89bdd0e95b23b" rel = "stylesheet" >
< link href = "_static/styles/pydata-sphinx-theme.css?digest=9b1a4fa89bdd0e95b23b" rel = "stylesheet" >
< link rel = "stylesheet"
href="_static/vendor/fontawesome/6.1.2/css/all.min.css">
< link rel = "preload" as = "font" type = "font/woff2" crossorigin
href="_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2">
< link rel = "preload" as = "font" type = "font/woff2" crossorigin
href="_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2">
< link rel = "stylesheet" type = "text/css" href = "_static/pygments.css" / >
< link rel = "stylesheet" type = "text/css" href = "_static/css/custom.css" / >
<!-- Pre - loaded scripts that we'll load fully later -->
< link rel = "preload" as = "script" href = "_static/scripts/pydata-sphinx-theme.js?digest=9b1a4fa89bdd0e95b23b" >
< script data-url_root = "./" id = "documentation_options" src = "_static/documentation_options.js" > < / script >
< script src = "_static/jquery.js" > < / script >
< script src = "_static/underscore.js" > < / script >
< script src = "_static/_sphinx_javascript_frameworks_compat.js" > < / script >
< script src = "_static/doctools.js" > < / script >
< script > DOCUMENTATION _OPTIONS . pagename = 'api' ; < / script >
< link rel = "index" title = "Index" href = "genindex.html" / >
< link rel = "search" title = "Search" href = "search.html" / >
< link rel = "next" title = "Changelog" href = "changelog.html" / >
< link rel = "prev" title = "CategoryRelatedList" href = "api/categories.views.CategoryRelatedList.html" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< meta name = "docsearch:language" content = "en" >
< / head >
< body data-spy = "scroll" data-target = "#bd-toc-nav" data-offset = "180" data-default-mode = "" >
< input type = "checkbox" class = "sidebar-toggle" name = "__primary" id = "__primary" >
< label class = "overlay overlay-primary" for = "__primary" > < / label >
< input type = "checkbox" class = "sidebar-toggle" name = "__secondary" id = "__secondary" >
< label class = "overlay overlay-secondary" for = "__secondary" > < / label >
< div class = "search-button__wrapper" >
< div class = "search-button__overlay" > < / div >
< div class = "search-button__search-container" >
< form class = "bd-search d-flex align-items-center" action = "search.html" method = "get" >
< i class = "icon fas fa-search" > < / i >
< input type = "search" class = "form-control" name = "q" id = "search-input" placeholder = "Search the docs ..." aria-label = "Search the docs ..." autocomplete = "off" autocorrect = "off" autocapitalize = "off" spellcheck = "false" >
< span class = "search-button__kbd-shortcut" > < kbd class = "kbd-shortcut__modifier" > Ctrl< / kbd > +< kbd > K< / kbd > < / span >
< / form >
< / div >
< / div >
< nav class = "bd-header navbar navbar-expand-lg bd-navbar" id = "navbar-main" > < div class = "bd-header__inner bd-page-width" >
< label class = "sidebar-toggle primary-toggle" for = "__primary" >
< span class = "fas fa-bars" > < / span >
< / label >
< div id = "navbar-start" >
< a class = "navbar-brand logo" href = "index.html" >
< p class = "title logo__title" > Django Categories 1.9.1 documentation< / p >
< / a >
< / div >
< div class = "col-lg-9 navbar-header-items" >
< div id = "navbar-center" class = "mr-auto" >
< div class = "navbar-center-item" >
< nav class = "navbar-nav" >
< p class = "sidebar-header-items__title" role = "heading" aria-level = "1" aria-label = "Site Navigation" >
Site Navigation
< / p >
< ul id = "navbar-main-elements" class = "navbar-nav" >
< li class = "nav-item" >
< a class = "nav-link" href = "installation.html" >
Installation
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "getting_started.html" >
Getting Started
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "user_guide/index.html" >
User Guide
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "reference/index.html" >
Reference
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "api/index.html" >
API
< / a >
< / li >
< div class = "nav-item dropdown" >
< button class = "btn dropdown-toggle nav-item" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
More
< / button >
< div class = "dropdown-menu" >
< li class = "nav-item current active" >
< a class = "nav-link" href = "#" >
Adding Django Rest framework API endpoint
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "changelog.html" >
Changelog
< / a >
< / li >
< / div >
< / div >
< / ul >
< / nav >
< / div >
< / div >
< div id = "navbar-end" >
< div class = "navbar-end-item navbar-end__search-button-container" >
< button class = "btn btn-sm navbar-btn search-button search-button__button" title = "Search" >
< i class = "fas fa-search" > < / i >
< / button >
< / div >
< div class = "navbar-end-item" >
< span class = "theme-switch-button btn btn-sm btn-outline-primary navbar-btn rounded-circle" >
< a class = "theme-switch" data-mode = "light" > < i class = "fas fa-sun" > < / i > < / a >
< a class = "theme-switch" data-mode = "dark" > < i class = "far fa-moon" > < / i > < / a >
< a class = "theme-switch" data-mode = "auto" > < i class = "fas fa-adjust" > < / i > < / a >
< / span >
< / div >
< div class = "navbar-end-item" >
< ul id = "navbar-icon-links" class = "navbar-nav" aria-label = "Icon Links" >
< / ul >
< / div >
< / div >
< / div >
< div class = "search-button-container--mobile" >
< button class = "btn btn-sm navbar-btn search-button search-button__button" title = "Search" >
< i class = "fas fa-search" > < / i >
< / button >
< / div >
< label class = "sidebar-toggle secondary-toggle" for = "__secondary" >
< span class = "fas fa-outdent" > < / span >
< / label >
< / div >
< / nav >
< div class = "bd-container" >
< div class = "bd-container__inner bd-page-width" >
< div class = "bd-sidebar-primary bd-sidebar hide-on-wide" >
< div class = "sidebar-header-items sidebar-primary__section" >
< div class = "sidebar-header-items__center" >
< div class = "navbar-center-item" >
< nav class = "navbar-nav" >
< p class = "sidebar-header-items__title" role = "heading" aria-level = "1" aria-label = "Site Navigation" >
Site Navigation
< / p >
< ul id = "navbar-main-elements" class = "navbar-nav" >
< li class = "nav-item" >
< a class = "nav-link" href = "installation.html" >
Installation
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "getting_started.html" >
Getting Started
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "user_guide/index.html" >
User Guide
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "reference/index.html" >
Reference
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "api/index.html" >
API
< / a >
< / li >
< div class = "nav-item dropdown" >
< button class = "btn dropdown-toggle nav-item" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
More
< / button >
< div class = "dropdown-menu" >
< li class = "nav-item current active" >
< a class = "nav-link" href = "#" >
Adding Django Rest framework API endpoint
< / a >
< / li >
< li class = "nav-item" >
< a class = "nav-link" href = "changelog.html" >
Changelog
< / a >
< / li >
< / div >
< / div >
< / ul >
< / nav >
< / div >
< / div >
< div class = "sidebar-header-items__end" >
< div class = "navbar-end-item" >
< span class = "theme-switch-button btn btn-sm btn-outline-primary navbar-btn rounded-circle" >
< a class = "theme-switch" data-mode = "light" > < i class = "fas fa-sun" > < / i > < / a >
< a class = "theme-switch" data-mode = "dark" > < i class = "far fa-moon" > < / i > < / a >
< a class = "theme-switch" data-mode = "auto" > < i class = "fas fa-adjust" > < / i > < / a >
< / span >
< / div >
< div class = "navbar-end-item" >
< ul id = "navbar-icon-links" class = "navbar-nav" aria-label = "Icon Links" >
< / ul >
< / div >
< / div >
< / div >
< div class = "sidebar-end-items sidebar-primary__section" >
< div class = "sidebar-end-items__item" >
< / div >
< / div >
< / div >
< main class = "bd-main" >
< div class = "bd-content" >
< div class = "bd-article-container" >
< div class = "bd-header-article" >
< / div >
< article class = "bd-article" role = "main" >
< section id = "adding-django-rest-framework-api-endpoint" >
< span id = "api" > < / span > < h1 > Adding Django Rest framework API endpoint< a class = "headerlink" href = "#adding-django-rest-framework-api-endpoint" title = "Permalink to this heading" > #< / a > < / h1 >
< section id = "registering-the-api" >
< h2 > Registering the API< a class = "headerlink" href = "#registering-the-api" title = "Permalink to this heading" > #< / a > < / h2 >
< p > If you have installed Django REST framework, all you have to do is add categories router to your router:< / p >
< div class = "highlight-python notranslate" > < div class = "highlight" > < pre > < span > < / span > < span class = "kn" > from< / span > < span class = "nn" > categories.api.urls< / span > < span class = "kn" > import< / span > < span class = "n" > router< / span > < span class = "k" > as< / span > < span class = "n" > category_router< / span >
< span class = "n" > router< / span > < span class = "o" > =< / span > < span class = "n" > DefaultRouter< / span > < span class = "p" > ()< / span >
< span class = "n" > router< / span > < span class = "o" > .< / span > < span class = "n" > registry< / span > < span class = "o" > .< / span > < span class = "n" > extend< / span > < span class = "p" > (< / span > < span class = "n" > category_router< / span > < span class = "o" > .< / span > < span class = "n" > registry< / span > < span class = "p" > )< / span >
< / pre > < / div >
< / div >
< / section >
< / section >
< / article >
< footer class = "bd-footer-article" >
<!-- Previous / next buttons -->
< div class = 'prev-next-area' >
< a class = 'left-prev' id = "prev-link" href = "api/categories.views.CategoryRelatedList.html" title = "previous page" >
< i class = "fas fa-angle-left" > < / i >
< div class = "prev-next-info" >
< p class = "prev-next-subtitle" > previous< / p >
< p class = "prev-next-title" > CategoryRelatedList< / p >
< / div >
< / a >
< a class = 'right-next' id = "next-link" href = "changelog.html" title = "next page" >
< div class = "prev-next-info" >
< p class = "prev-next-subtitle" > next< / p >
< p class = "prev-next-title" > Changelog< / p >
< / div >
< i class = "fas fa-angle-right" > < / i >
< / a >
< / div >
< / footer >
< / div >
< div class = "bd-sidebar-secondary bd-toc" >
< div class = "toc-item" >
< div class = "tocsection onthispage" >
< i class = "fas fa-list" > < / i > On this page
< / div >
< nav id = "bd-toc-nav" class = "page-toc" >
< ul class = "visible nav section-nav flex-column" >
< li class = "toc-h2 nav-item toc-entry" >
< a class = "reference internal nav-link" href = "#registering-the-api" >
Registering the API
< / a >
< / li >
< / ul >
< / nav >
< / div >
< div class = "toc-item" >
< / div >
< div class = "toc-item" >
< div class = "tocsection sourcelink" >
< a href = "_sources/api.rst.txt" >
< i class = "fas fa-file-alt" > < / i > Show Source
< / a >
< / div >
< / div >
< / div >
< / div >
< footer class = "bd-footer-content" >
< div class = "bd-footer-content__inner" >
< / div >
< / footer >
< / main >
< / div >
< / div >
<!-- Scripts loaded after <body> so the DOM is not blocked -->
< script src = "_static/scripts/pydata-sphinx-theme.js?digest=9b1a4fa89bdd0e95b23b" > < / script >
< footer class = "bd-footer" > < div class = "bd-footer__inner container" >
< div class = "footer-item" >
< p class = "copyright" >
© Copyright 2010-2022, Corey Oordt.< br >
< / p >
< / div >
< div class = "footer-item" >
< p class = "sphinx-version" >
Created using < a href = "http://sphinx-doc.org/" > Sphinx< / a > 5.1.1.< br >
< / p >
< / div >
< / div >
< / footer >
< / body >
2022-09-23 17:10:14 +00:00
< / html >