Exemplo n.º 1
0
from django.conf.urls import url
from django.conf.urls import include
from django.http import HttpResponse
from django.contrib import admin
from . import views
from alunos.models import Student, Teacher, Grade
from alunos.views import StudentList, TeacherList, StudentCreate, StudentUpdate, StudentDelete, TeacherCreate, TeacherUpdate, TeacherDelete, StudentAddUser
from django.contrib.auth.decorators import login_required, permission_required

urlpatterns = [
	url(r'^',include('django.contrib.auth.urls')),
        url(r'^students/all', login_required(StudentList.as_view()),name ='student-list'),
        url(r'^teachers/all', login_required(TeacherList.as_view()),name ='teacher-list'),
	#url(r'^alunos/', TemplateView.as_view(template_name="alunos.html")),
    url(r'students/adduser', login_required(views.StudentAddUser), name == 'add_student_user'),
    url(r'students/add/$', login_required(StudentCreate.as_view()), name='student_add'),
    url(r'students/(?P<pk>[0-9]+)/$', login_required(StudentUpdate.as_view()), name='student_update'),
    url(r'students/(?P<pk>[0-9]+)/delete/$', login_required(StudentDelete.as_view()), name='student_delete'),
    url(r'teachers/add/$', login_required(TeacherCreate.as_view()), name='teacher_add'),
    url(r'teachers/(?P<pk>[0-9]+)/$', login_required(TeacherUpdate.as_view()), name='teacher_update'),
    url(r'teachers/(?P<pk>[0-9]+)/delete/$', login_required(TeacherDelete.as_view()), name='teacher_delete'),
]
Exemplo n.º 2
0
from django.conf.urls import url
from django.conf.urls import include
from django.http import HttpResponse
from django.contrib import admin
from . import views
from alunos.models import Student, Teacher, Grade
from alunos.views import StudentList, TeacherList, StudentCreate, StudentUpdate, StudentDelete, TeacherCreate, TeacherUpdate, TeacherDelete, StudentAddUser

urlpatterns = [
	url(r'^',include('django.contrib.auth.urls')),
        url(r'^students/all', StudentList.as_view(),name ='student-list'),	
        url(r'^teachers/all', TeacherList.as_view(),name ='teacher-list'),
	#url(r'^alunos/', TemplateView.as_view(template_name="alunos.html")),
    url(r'students/adduser', views.StudentAddUser, name == 'add_student_user'),
    url(r'students/add/$', StudentCreate.as_view(), name='student_add'),
    url(r'students/(?P<pk>[0-9]+)/$', StudentUpdate.as_view(), name='student_update'),
    url(r'students/(?P<pk>[0-9]+)/delete/$', StudentDelete.as_view(), name='student_delete'),
    url(r'teachers/add/$', TeacherCreate.as_view(), name='teacher_add'),
    url(r'teachers/(?P<pk>[0-9]+)/$', TeacherUpdate.as_view(), name='teacher_update'),
    url(r'teachers/(?P<pk>[0-9]+)/delete/$', TeacherDelete.as_view(), name='teacher_delete'),
]
Exemplo n.º 3
0
from django.conf.urls import include
from django.http import HttpResponse
from django.contrib import admin
from . import views
from alunos.models import Student, Teacher, Grade
from alunos.views import (
    StudentList,
    TeacherList,
    StudentCreate,
    StudentUpdate,
    StudentDelete,
    TeacherCreate,
    TeacherUpdate,
    TeacherDelete,
    StudentAddUser,
)

urlpatterns = [
    url(r"^", include("django.contrib.auth.urls")),
    url(r"^students/all", StudentList.as_view(), name="student-list"),
    url(r"^teachers/all", TeacherList.as_view(), name="teacher-list"),
    # url(r'^alunos/', TemplateView.as_view(template_name="alunos.html")),
    url(r"students/adduser", views.StudentAddUser, name == "add_student_user"),
    url(r"students/add/$", StudentCreate.as_view(), name="student_add"),
    url(r"students/(?P<pk>[0-9]+)/$", StudentUpdate.as_view(), name="student_update"),
    url(r"students/(?P<pk>[0-9]+)/delete/$", StudentDelete.as_view(), name="student_delete"),
    url(r"teachers/add/$", TeacherCreate.as_view(), name="teacher_add"),
    url(r"teachers/(?P<pk>[0-9]+)/$", TeacherUpdate.as_view(), name="teacher_update"),
    url(r"teachers/(?P<pk>[0-9]+)/delete/$", TeacherDelete.as_view(), name="teacher_delete"),
]
Exemplo n.º 4
0
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls import url
from django.conf.urls import include
from django.http import HttpResponse
from django.contrib import admin
from alunos.models import Student, Teacher
from alunos.views import StudentList, TeacherList, StudentCreate, StudentUpdate, StudentDelete, TeacherCreate, TeacherUpdate, TeacherDelete

urlpatterns = [
	url(r'^',include('django.contrib.auth.urls')),
        url(r'^students/', StudentList.as_view()),	
        url(r'^teachers/', TeacherList.as_view()),
	#url(r'^alunos/', TemplateView.as_view(template_name="alunos.html")),
    
    url(r'student/add/$', StudentCreate.as_view(), name='student_add'),
    url(r'student/(?P<pk>[0-9]+)/$', StudentUpdate.as_view(), name='student_update'),
    url(r'student/(?P<pk>[0-9]+)/delete/$', StudentDelete.as_view(), name='student_delete'),
    url(r'teacher/add/$', TeacherCreate.as_view(), name='teacher_add'),
    url(r'teacher/(?P<pk>[0-9]+)/$', TeacherUpdate.as_view(), name='teacher_update'),
    url(r'teacher/(?P<pk>[0-9]+)/delete/$', TeacherDelete.as_view(), name='teacher_delete'),
    url(r'^admin/', include(admin.site.urls)),
]