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

added requirements to api

parent ad4ac1b2
from rest_framework import serializers
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 Meta:
......
......@@ -2,9 +2,9 @@ from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from mainapp.views import (ProgramViewSet, CourseViewSet, CourseGroupViewSet,
TrajectoryViewSet, build_trajectory, SemesterViewSet, BuildResponseViewSet,
DetailStudent, ProfileView)
DetailStudent, ProfileView, RequirementViewSet)
from mainapp.models import (Program, Course, CourseGroup, Trajectory, Semester,
BuildResponse, Student)
BuildResponse, Student, Requirement)
from rest_framework.routers import DefaultRouter
......@@ -15,6 +15,7 @@ router.register(r'coursegroups', CourseGroupViewSet)
router.register(r'trajectories', TrajectoryViewSet)
router.register(r'semesters', SemesterViewSet)
router.register(r'buildresponses', BuildResponseViewSet)
router.register(r'requirements', RequirementViewSet
urlpatterns = patterns('',
# Examples:
......
......@@ -6,10 +6,10 @@ from rest_framework import viewsets
from mainapp.serializers import (ProgramSerializer, CourseSerializer,
CourseGroupSerializer, TrajectorySerializer, SemesterSerializer,
BuildResponseSerializer)
BuildResponseSerializer, RequirementSerializer)
from mainapp.models import (Trajectory, Program, Major, Minor, GenEd,
Concentration, MetaCourse, Course, CourseGroup, Semester, BuildResponse,
Student)
Student, Requirement)
from mainapp.forms import StartTrajectoryForm, StudentForm
# Create your views here.
#FBV's
......@@ -35,6 +35,10 @@ def searchMajorMinor(request):
#API SHIT
class RequirementViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Requirement.objects.all()
serializer_class = RequirementSerializer
class ProgramViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Program.objects.all()
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