Commit cebbe1b4 authored by Ben Waters's avatar Ben Waters
Browse files

added requirements to api

parent ad4ac1b2
from rest_framework import serializers from rest_framework import serializers
from mainapp.models import (Trajectory, Program, Major, Minor, GenEd, Concentration, from mainapp.models import (Trajectory, Program, Major, Minor, GenEd, Concentration,
MetaCourse, Course, CourseGroup, Semester, BuildResponse) MetaCourse, Course, CourseGroup, Semester, BuildResponse, Requirement)
class RequirementSerializer(serializers.ModelSerializer):
class TrajectorySerializer(serializers.ModelSerializer): class TrajectorySerializer(serializers.ModelSerializer):
class Meta: class Meta:
......
...@@ -2,9 +2,9 @@ from django.conf.urls import patterns, include, url ...@@ -2,9 +2,9 @@ from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView from django.views.generic import TemplateView
from mainapp.views import (ProgramViewSet, CourseViewSet, CourseGroupViewSet, from mainapp.views import (ProgramViewSet, CourseViewSet, CourseGroupViewSet,
TrajectoryViewSet, build_trajectory, SemesterViewSet, BuildResponseViewSet, TrajectoryViewSet, build_trajectory, SemesterViewSet, BuildResponseViewSet,
DetailStudent, ProfileView) DetailStudent, ProfileView, RequirementViewSet)
from mainapp.models import (Program, Course, CourseGroup, Trajectory, Semester, from mainapp.models import (Program, Course, CourseGroup, Trajectory, Semester,
BuildResponse, Student) BuildResponse, Student, Requirement)
from rest_framework.routers import DefaultRouter from rest_framework.routers import DefaultRouter
...@@ -15,6 +15,7 @@ router.register(r'coursegroups', CourseGroupViewSet) ...@@ -15,6 +15,7 @@ router.register(r'coursegroups', CourseGroupViewSet)
router.register(r'trajectories', TrajectoryViewSet) router.register(r'trajectories', TrajectoryViewSet)
router.register(r'semesters', SemesterViewSet) router.register(r'semesters', SemesterViewSet)
router.register(r'buildresponses', BuildResponseViewSet) router.register(r'buildresponses', BuildResponseViewSet)
router.register(r'requirements', RequirementViewSet
urlpatterns = patterns('', urlpatterns = patterns('',
# Examples: # Examples:
......
...@@ -6,10 +6,10 @@ from rest_framework import viewsets ...@@ -6,10 +6,10 @@ from rest_framework import viewsets
from mainapp.serializers import (ProgramSerializer, CourseSerializer, from mainapp.serializers import (ProgramSerializer, CourseSerializer,
CourseGroupSerializer, TrajectorySerializer, SemesterSerializer, CourseGroupSerializer, TrajectorySerializer, SemesterSerializer,
BuildResponseSerializer) BuildResponseSerializer, RequirementSerializer)
from mainapp.models import (Trajectory, Program, Major, Minor, GenEd, from mainapp.models import (Trajectory, Program, Major, Minor, GenEd,
Concentration, MetaCourse, Course, CourseGroup, Semester, BuildResponse, Concentration, MetaCourse, Course, CourseGroup, Semester, BuildResponse,
Student) Student, Requirement)
from mainapp.forms import StartTrajectoryForm, StudentForm from mainapp.forms import StartTrajectoryForm, StudentForm
# Create your views here. # Create your views here.
#FBV's #FBV's
...@@ -35,6 +35,10 @@ def searchMajorMinor(request): ...@@ -35,6 +35,10 @@ def searchMajorMinor(request):
#API SHIT #API SHIT
class RequirementViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Requirement.objects.all()
serializer_class = RequirementSerializer
class ProgramViewSet(viewsets.ReadOnlyModelViewSet): class ProgramViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Program.objects.all() queryset = Program.objects.all()
serializer_class = ProgramSerializer serializer_class = ProgramSerializer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment