Beispiel #1
0
from django.contrib import admin
from django.urls import path, include
from escola.urls import router_urls
from escola.views import ListaMatriculasAluno, ListaAlunosMatriculados

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(router_urls)),
    path('lista/matriculas/aluno/<int:pk>/', ListaMatriculasAluno.as_view()),
    path('lista/matriculas/curso/<int:pk>/',
         ListaAlunosMatriculados.as_view()),
]
from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from escola.views import (
    AlunosViewSet,
    CursosViewSet,
    MatriculaViewSet,
    ListaMatriculaAluno,
    ListaAlunosMatriculados,
)

router = routers.DefaultRouter()
router.register('alunos', AlunosViewSet, basename='Alunos')
router.register('cursos', CursosViewSet, basename='Cursos')
router.register('matriculas', MatriculaViewSet, basename='Matriculas')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(router.urls)),
    path('aluno/<int:pk>/matriculas', ListaMatriculaAluno.as_view()),
    path('curso/<int:pk>/matriculas', ListaAlunosMatriculados.as_view()),
]