Commit 2a36b493 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

made the urls work with the cbvs

parent 99cd9bf8
......@@ -2,24 +2,38 @@ from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
from trajectories.views import course, student, trajectory, new, create
from trajectories.views import newTrajectory, buildTrajectory, studentDetail, studentUpdate, courseDetail, programDetail, programDetail, trajectoryDetail, trajectoryList, programList
urlpatterns = patterns('',
# course
url(r'^course/(?P<courseSlug>\w+)/$', course, name = 'course'),
### detail pages ##
# student's page
url(r'^(?P<username>\w+)/$', student, name = 'student'),
url(r'^(?P<username>\w+)/$', studentDetail, name = 'studentDetail'),
# course
url(r'^course/(?P<courseSlug>\w+)/$', courseDetail, name = 'courseDetail'),
# program
url(r'^program/(?P<programSlug>\w+)/$', programDetail, name = 'programDetail'),
# trajectory
url(r'^(?P<username>\w+)/(?P<trajectorySlug>\w+)$', trajectoryDetail, name = 'trajectoryDetail'),
### list pages ###
# single trajectory page
url(r'^(?P<username>\w+)/(?P<trajectorySlug>\w+)$', trajectory, name = 'trajectory'),
# trajectories
url(r'^(?P<username>\w+)/trajectories/$', trajectoryList, name = 'trajectoryList'),
# programs
url(r'^programs/$', programList, name = 'programList'),
### create pages ###
# trajectory
url(r'^new/$', newTrajectory, name = 'newTrajectory'),
# a new trajectory
# url(r'^user/(?P<username>\w+)/new/$', 'new', name = 'new'),
url(r'^new/$', new, name = 'new'),
### update pages ###
# creating the trajectory
# url(r'^user/(?P<username>\w+)/create/$', 'create', name = 'create'),
url(r'^create/$', create, name = 'create'),
# trajectory
url(r'^(?P<username>\w+)/build/(?P<trajectorySlug>)$', buildTrajectory, name = 'buildTrajectory'),
# student
url(r'(?P<username>\w+)/update$', studentUpdate, name = 'studentUpdate'),
)
......@@ -2,47 +2,47 @@ from django.shortcuts import render, get_object_or_404
from django.db.models import Max
from django.views.generic import *
from trajectories.models import Course, CourseCollection, Program, Student, Trajectory
from trajecgtories.utils import *
from trajectories.utils import *
from braces.views import LoginRequiredMixin
# create a new trajectory
def NewTrajectory(LoginRequiredMixin, CreateView):
def newTrajectory(LoginRequiredMixin, CreateView):
model = Trajectory
form = CreateTrajectoryForm
# build the trajectory
def BuildTrajectory(LoginRequiredMixin, UpdateView):
def buildTrajectory(LoginRequiredMixin, UpdateView):
model = Trajectory
form = BuildTrajectoryForm
# student's page; shows saved trajectories
def StudentDetail(LoginRequiredMixin, DetailView):
def studentDetail(LoginRequiredMixin, DetailView):
model = Student
# student can edit their information, such as previous classes or isHonors
def StudentUpdate(LoginRequiredMixin, UpdateView):
def studentUpdate(LoginRequiredMixin, UpdateView):
models = Student
form = StudentUpdateForm
# details of a course
def CourseDetail(DetailView):
def courseDetail(DetailView):
model = Course
# details of a program
def ProgramDetail(DetailView):
def programDetail(DetailView):
model = Program
# details of a program
def TrajectoryDetail(LoginRequiredMixin, DetailView):
def trajectoryDetail(LoginRequiredMixin, DetailView):
model = Trajectory
# lists all of your trajectories
def TrajectoryList(LoginRequiredMixin, ListView):
def trajectoryList(LoginRequiredMixin, ListView):
model = Trajectory
# needs to make it so it's your trajectory
# or eventually, public as well
# lists all programs
def ProgramList(ListView):
def programList(ListView):
model = Program
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