Skip to content

Instantly share code, notes, and snippets.

@moeinserpico
Created September 30, 2019 06:19
Show Gist options
  • Save moeinserpico/97cec4ea94b5631de967717a2e5f8d30 to your computer and use it in GitHub Desktop.
Save moeinserpico/97cec4ea94b5631de967717a2e5f8d30 to your computer and use it in GitHub Desktop.
from django.shortcuts import render
from rest_framework import viewsets
from .serializers import *
from .models import *
class EmployeeAPI(viewsets.ModelViewSet):
serializer_class = EmployeeSerializer
queryset = Employees.objects.all()[:5]
class DepartmentsAPI(viewsets.ModelViewSet):
serializer_class = DepartmentsSerializer
queryset = Departments.objects.all()[:5]
class DeptManagerAPI(viewsets.ModelViewSet):
serializer_class = DeptManagerSerializer
queryset = DeptManager.objects.all()[:5]
class DeptEmpAPI(viewsets.ModelViewSet):
serializer_class = DeptEmpSerializer
queryset = DeptEmp.objects.all()[:5]
class SalariesAPI(viewsets.ModelViewSet):
serializer_class = SalariesSerializer
queryset = Salaries.objects.all()[:5]
class TitlesAPI(viewsets.ModelViewSet):
serializer_class = TitlesSerializers
queryset = Titles.objects.all()[:5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment