Skip to content

Commit

Permalink
refact(#12): implement function based view
Browse files Browse the repository at this point in the history
  • Loading branch information
victorcommite committed Jun 8, 2019
1 parent 43e6460 commit b5ef6a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions students/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.urls import path
from django.conf.urls import url
from .views import list_students, create_student, update_student, delete_student
from students import views

urlpatterns = [
path('', list_students, name='list_students'),
path('new/', create_student, name='create_students'),
path('update/<int:id>/', update_student, name='update_student'),
path('delete/<int:id>/', delete_student, name='delete_student')
path('', views.list_students, name='list_students'),
path('new/', views.create_student, name='create_students'),
path('update/<int:id>/', views.update_student, name='update_student'),
path('delete/<int:id>/', views.delete_student, name='delete_student')
]
5 changes: 5 additions & 0 deletions students/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
from rest_framework import viewsets
from .serializers import StudentLoginSerializer, StudentFieldsSerializer

class StudentForm(StudentForm):
class Meta:
model = Student
fields = ['nome', 'matricula', 'email', 'senha']

class StudentLoginViewSet(viewsets.ModelViewSet):
queryset = Student.objects.all()
serializer_class = StudentLoginSerializer
Expand Down

0 comments on commit b5ef6a4

Please sign in to comment.