Esempio n. 1
0
from django.db import router
from django.urls import path

from rest_framework.routers import SimpleRouter

from cursos.views import (CursoAPIView, CursosAPIView, AvaliacaoAPIView,
                          AvaliacoesAPIView, CursoViewSet, AvaliacaoViewSet)

router = SimpleRouter()

# Api v2
router.register('cursos', CursoViewSet)
router.register('avaliacoes', AvaliacaoViewSet)

# Api v1
urlpatterns = [
    path('cursos/', CursosAPIView.as_view(), name='cursos'),
    path('cursos/<int:pk>/', CursoAPIView.as_view(), name='curso'),
    path('cursos/<int:curso_pk>/avaliacoes/',
         AvaliacoesAPIView.as_view(),
         name='curso_avaliacoes'),
    path('cursos/<int:curso_pk>/avaliacoes/<int:avaliacao_pk>/',
         AvaliacaoAPIView.as_view(),
         name='curso_avaliacao'),
    path('avaliacoes/', AvaliacoesAPIView.as_view(), name='avaliacoes'),
    path('avaliacoes/<int:avaliacao_pk>/',
         AvaliacaoAPIView.as_view(),
         name='avaliacao'),
]
Esempio n. 2
0
from django.contrib import admin
from django.db import router
from django.urls import path, include
from rest_framework import views
from rest_framework.routers import DefaultRouter
from api import views  # type: ignore

router = DefaultRouter()

router.register('studentapi', views.StudentModelViewSet, basename='student')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(router.urls)),
]
from django import urls
from django.db import router
from django.urls import path, include
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

from rest_framework import routers
from .views import prueba, tipoDocumentoViewSet

router = routers.DefaultRouter()
router.register(r'docs', tipoDocumentoViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
]
Esempio n. 4
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.db import router
from django.urls import path, include
from tutorial.quickstart import views
from rest_framework import routers

router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path('api-auth/', include('rest_framework.urls',
                              namespace='rest_framework')),
    path('admin/', admin.site.urls),
]
Esempio n. 5
0
from django.db import router
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from users.api import UsersViewSet
from users.views import LoginView, LogoutView, SignUpView, UsersListView

router = DefaultRouter()
router.register('users', UsersViewSet, base_name='users')

urlpatterns = [
    path('login', LoginView.as_view(), name='login'),
    path('logout', LogoutView.as_view(), name='logout'),
    path('signup', SignUpView.as_view(), name='signup'),
    path('users', UsersListView.as_view(), name='users'),

    # API
    path('api/1.0/', include(router.urls)),
]
Esempio n. 6
0
from django import urls
from django.db import router
from django.urls import path, include
from .views import article_list, article_detail, ArticleApiView, ArticleDetail, GenericAPIView, ArticleViewSet
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register('article', ArticleViewSet, basename='article')

urlpatterns = [
    path('viewset/', include(router.urls)),
    path('viewset/<int:id>/', include(router.urls)),

    # path('article/', article_list, name="article"),
    path('article/', ArticleApiView.as_view(), name="article"),
    path('generic/article/<int:id>/', GenericAPIView.as_view(),
         name="article"),

    # path('detail/<int:pk>/', article_detail, name="detail")
    path('detail/<int:id>/', ArticleDetail.as_view(), name="detail")
]
Esempio n. 7
0
from django.contrib import admin
from django.db import router
from django.urls import path, include
from escola.views import AlunosViewSet
from rest_framework import routers

router = routers.DefaultRouter()
router.register(r'alunos', AlunosViewSet)

urlpatterns = [path('admin/', admin.site.urls), path('', include(router.urls))]
Esempio n. 8
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from django.db import router
from api import views
from rest_framework import routers

router = routers.DefaultRouter()
router.register('data', views.DataView)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('data.urls')),
    path('api/', include(router.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 9
0
from django.db import router
from django.urls import path, include
from django.contrib import admin
from rest_framework import routers
from app import views

router = routers.DefaultRouter()
router.register(r'phonebook', views.PhonebookView, 'phonebook')

urlpatterns = [
    path("", views.home, name="home"),
    # path('admin/', admin.site.urls),
    path('api/', include(router.urls)),
    path('hello/', views.HelloView.as_view(), name='hello'),
    path(r'^api/phonebook/', views.contact_list, name='contact_list'),
    path(r'^api/phonebook/<int:id>/',
         views.contact_detail,
         name='contact_detail'),
    path(r'^api/phonebook/lastname/',
         views.contact_last_name,
         name='contact_last_name'),
]
from django.contrib import admin
from django.db import router
from django.db.models import base
from django.urls import path, include
from artigos.views import ArtigoViewSet, CategoriaViewSet, ListaArtigoPublicadoAtivoViewSet
from contatos.views import ContatosViewSet
from rest_framework import routers

router = routers.DefaultRouter()
router.register('artigos', ArtigoViewSet, basename='Artigos')
router.register('categorias', CategoriaViewSet, basename='Categorias')
router.register('contatos', ContatosViewSet, basename='Contatos')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(router.urls)),
    path('artigos/ativo', ListaArtigoPublicadoAtivoViewSet.as_view())
]
Esempio n. 11
0
from .views import ArticleViewSet, ConventionViewSet, IntervenantViewSet, ConventionsWithMeIncluded
from django.db import router
from django.urls import path
from rest_framework.routers import SimpleRouter

router = SimpleRouter()
router.register('conventions', ConventionViewSet, basename='conventions')
router.register('articles', ArticleViewSet, basename='articles')
router.register('intervenants', IntervenantViewSet, basename='intervenants')

urlpatterns = [
    path('conventions/me',
         ConventionsWithMeIncluded.as_view(),
         name='conventionsWithMeIncluded')
]

urlpatterns += router.urls
Esempio n. 12
0
from django.conf.urls import url
from django.db import router
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from recruitment_app import views
from recruitment_app.views import url_detail

router = DefaultRouter()
router.register(r'Users', views.UserViewSet)
router.register(r'Add_URL', views.AddURLViewSet)
router.register(r'View_details', views.ShortURLViewSet, basename='Details')

urlpatterns = [
    path('', include(router.urls)),
    url(r'^(?P<shorturl>[!0-9A-Za-z]{1,9})/$', url_detail, name='shorturl'),
]
Esempio n. 13
0
from django.db import router
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from .views import CommentViewSet, PostViewSet

# Создаем роутер.
router = DefaultRouter()
# Связываем URL с viewset.
router.register(r'api/v1/posts', PostViewSet)
router.register(r'api/v1/posts/(?P<post_id>\d+)/comments',
                CommentViewSet,
                basename='comment')

# Все зарегистрированные в router пути доступны в router.urls.
urlpatterns = [
    path('', include(router.urls)),
]
Esempio n. 14
0
from rest_framework import urlpatterns
from django.db import router
from rest_framework.routers import DefaultRouter
from .views import AccommodationView, LandlordAccommodationView

router = DefaultRouter()
router.register('my-accommodations',
                LandlordAccommodationView,
                basename='landlord-accommodations')
router.register('', AccommodationView, basename='accommodations')

urlpatterns = router.urls
Esempio n. 15
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.db import router
from django.urls import path, include
from rest_framework import routers
from empressa_api import views

router = routers.DefaultRouter()
router.register(r'usuario', views.UserViewSet)
router.register(r'empressa', views.EmpressaViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(router.urls)),
    path('api-auth/', include('rest_framework.urls',
                              namespace='rest_framework'))
]
Esempio n. 16
0
from django.conf.urls import include, url
from django.db import router
from django.urls import path, include
from rest_framework import viewsets
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.routers import DefaultRouter, SimpleRouter

from activitys import views
from activitys.views import ActivitysCategorysViewSet, ActivitysViewSet

# Create a router and register the viewsets with it
router = SimpleRouter()
router.register(r'activityscategorys', views.ActivitysCategorysViewSet)
router.register(r'activitys', views.ActivitysViewSet)

# URL patterns are now determined automatically by the router
urlpatterns = [
    path('', include(router.urls)),
]
Esempio n. 17
0
from django.db import router
from django.urls import path
from rest_framework.routers import DefaultRouter

from editoriales.views import EditorialViewSet

router = DefaultRouter()
router.register('', EditorialViewSet)

urlpatterns = router.urls
Esempio n. 18
0
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin

from django.conf.urls import url, include
from django.db import router
from rest_framework.routers import DefaultRouter

from author import views

router = DefaultRouter()
router.register(r'author', views.AuthorViewset)
router.register(r'category', views.CategoryViewset)
router.register(r'book', views.BookViewset)
router.register(r'branch', views.BranchViewset)
router.register(r'branch_book_stock', views.BranchBookStockViewset)
router.register(r'bill', views.BillViewset)
router.register(r'invoice', views.InvoiceViewset)

apiUrlPatterns = [
    url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
    url('', include(router.urls)),
]

urlpatterns = [
    url(r'^api/', include(apiUrlPatterns)),
    url('admin/', admin.site.urls),
Esempio n. 19
0
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.db import router
from django.shortcuts import redirect
from django.templatetags.static import static
from django.urls import reverse
from django.conf.urls import include, url
from rest_framework import routers

from rest_framework_jwt.views import ObtainJSONWebToken

from rest_framework.routers import DefaultRouter

from modules.address.views import AddressViewSet
from modules.phone.views import PhoneViewSet
from modules.register_contact.views import RegisterContactViewSet
from project import settings

router = routers.DefaultRouter()

router.register(r'register', viewset=RegisterContactViewSet)
router.register(r'phone', viewset=PhoneViewSet)
router.register(r'address', viewset=AddressViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework'))
]
Esempio n. 20
0
from django.db import router
from rest_framework import urlpatterns
from rest_framework.routers import DefaultRouter
from .views import ReceiptView

router = DefaultRouter()
router.register('my-receipts', ReceiptView, basename='my-receipts')

urlpatterns = router.urls
Esempio n. 21
0
"""
from django.contrib import admin
from django.db import router
from django.urls import path, include

from films.views import hello_world, error_page

from films.views import MoviesListAll, GenreListAll, PostCreateView, PostCreateGenreView, PostUpdateGenreView, \
    PostDeleteGenreView, PostUpdateMovieView, PostDeleteMovieView, UserViewSet, MovieViewSet, UserViewSet, GroupViewSet
#api
from rest_framework import routers

from rest_framework.authtoken import views

router = routers.DefaultRouter()
router.register('users', UserViewSet)
router.register('groups', GroupViewSet)
router.register('api-movies', MovieViewSet, base_name='s')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', hello_world),
    path('error/', error_page),
    path(
        'movies/',
        MoviesListAll.as_view(),
    ),
    path(
        'movie/add/',
        PostCreateView.as_view(),
    ),
Esempio n. 22
0
from django.contrib import admin
from django.urls import path, include
import user, diary, account, post
from django.db import router
from rest_framework import routers
from diary.views import PostViewSet

router = routers.DefaultRouter()
router.register('money', PostViewSet, basename='money')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include(router.urls)),
    path('users/', include('user.urls')),
    path('api1/', include('diary.urls')),
    path('api2/', include('account.urls')),
    path('api3/', include('post.urls')),
]
Esempio n. 23
0
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""



from django.db import router
from django.urls import path
from django.urls.conf import include
from rest_framework import routers
from whattodoapi.views import login_user, register_user, CategoryViewSet, TodoViewSet, TagViewSet, UserViewSet
from django.conf.urls.static import static
from django.conf import settings

"""Router"""
router = routers.DefaultRouter(trailing_slash=False)
router.register(r'categories', CategoryViewSet, 'category')
router.register(r'todos', TodoViewSet, 'todo')
router.register(r'tags', TagViewSet, 'tag')
router.register(r'user', UserViewSet, 'user')


urlpatterns = [
    path('', include(router.urls)),
    path('register', register_user),
    path('login', login_user),
    path('api-auth', include('rest_framework.urls', namespace='rest_framework')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 24
0
from django.db import router
from django.urls import path
from django.urls.conf import include
from .views import UserViewset, OrganizationViewset, GroupViewset, PermissionViewset
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register('users', UserViewset, basename='users')
router.register('organizations', OrganizationViewset, basename='organizations')
router.register('groups', GroupViewset, basename='groups')
router.register('permissions', PermissionViewset, basename='permissions')

urlpatterns = [
    # path('users/', UsersAPIView.as_view()),
    # path('users/<int:id>/',UserDetailAPIView.as_view())
    # path('users/',UserViewset.as_view()),
    path('', include(router.urls)),
]
Esempio n. 25
0
"""
from django.contrib import admin
from django.db import router
from django.urls import path, include

from django.conf.urls.static import static
from django.conf import settings

from api import views

from rest_framework import routers

from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

router = routers.DefaultRouter()
router.register('listings', views.ListingView)
router.register('realtors', views.RealtorView)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('pages.urls')),
    path('listings/', include('listings.urls')),
    path('', include('contacts.urls')),
    path('api/', include(router.urls)),
    path('', include('accounts.urls')),
    path('api-auth/', include('rest_framework.urls')),
    path('api/token/', TokenObtainPairView.as_view()),
    path('api/token/refresh', TokenRefreshView.as_view()),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Esempio n. 26
0
from django.db import router
from django.urls import path, include
from .views import ArticleViewSet, UserViewSet
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register("articles", ArticleViewSet, basename="articles")
router.register("users", UserViewSet, basename="users")

urlpatterns = [
    path("api/", include(router.urls)),
]
Esempio n. 27
0
from django.db import router
from rest_framework import routers

from siteoptions.api.views import OptionsViewSet

router = routers.SimpleRouter()

router.register(r'options', viewset=OptionsViewSet)

urlpatterns = [

]
urlpatterns += router.urls
Esempio n. 28
0
from django.urls import path, include
from .views import BlacklistTokenUpdateView
from dj_rest_auth.registration.views import VerifyEmailView, ConfirmEmailView
from rest_framework import urlpatterns
from django.db import router
from rest_framework.routers import DefaultRouter
from .views import UserView, UserEditView, UserProfileView

router = DefaultRouter()
router.register("my-profile/edit", UserEditView, basename="profile-edit")
router.register("my-profile/detail", UserView, basename="profile-detail")
router.register("users", UserProfileView, basename="users")

urlpatterns = [
     path("registration/account-confirm-email/<str:key>/",
         ConfirmEmailView.as_view()),
     path("", include("dj_rest_auth.urls")),
     path("login/", include("dj_rest_auth.urls")),
     path("logout/blacklist/",
          BlacklistTokenUpdateView.as_view(),
          name="blacklist"),
     path("registration/", include("dj_rest_auth.registration.urls")),
     path("account-confirm-email/", VerifyEmailView.as_view()),
]

urlpatterns += router.urls
Esempio n. 29
0
from django.db import router
from django.urls import path, include
from . import views
from rest_framework import routers

router = routers.DefaultRouter()
router.register('producto', views.ProductoViewset)
router.register('marca', views.MarcaViewset)

urlpatterns = [
    path('', views.home, name='home'),
    path('contacto/', views.contacto, name='contacto'),
    path('galeria/', views.galeria, name='galeria'),
    path('agregar-producto/', views.agregar_producto, name='agregar_producto'),
    path('productos/', views.listar_productos, name='listar_productos'),
    path('modificar-producto/<id>',
         views.modificar_producto,
         name='modificar_producto'),
    path('eliminar-producto/<id>',
         views.eliminar_producto,
         name='eliminar_producto'),
    path('registro', views.registro, name='registro'),
    path('api/', include(router.urls)),
]
Esempio n. 30
0
from django.db import router
from django.urls import path
from django.urls.conf import include
from .views import TagsViewset, SourceViewset, CountryViewset, NewsViewset
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register('tags',TagsViewset, basename='tags')
router.register('source',SourceViewset, basename='source')
router.register('country',CountryViewset, basename='country')
router.register('news',NewsViewset, basename='news')

urlpatterns = [
    path('',include(router.urls)),
]
Esempio n. 31
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.db import router
from tests.views import TestObjectViewSet

router.register(r'test', TestObjectViewSet, base_name='api-test')

urlpatterns = patterns(
    '',
    url(r'^admin/', include(admin.site.urls)),
    # url(r'^test/', TestObjectViewSet.as_view(), 'test')
)