Commit 04e815d9 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

advisor uses suburls

parent aa6239d9
...@@ -2,7 +2,7 @@ from django.conf.urls import patterns, include, url ...@@ -2,7 +2,7 @@ from django.conf.urls import patterns, include, url
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
# from django.contrib.auth.views import login, logout from django.contrib.auth.views import login, logout
from advisor.views import index, about, privacy from advisor.views import index, about, privacy
#, login? #, login?
...@@ -37,6 +37,10 @@ urlpatterns = patterns('', ...@@ -37,6 +37,10 @@ urlpatterns = patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
) )
# App sub-urls
url(r'^trajectory/', include('trajectories.urls')),
url(r'^analysis/', include('analysis.urls'))
urlpatterns += patterns('django.contrib.auth.views', urlpatterns += patterns('django.contrib.auth.views',
# auth pages # auth pages
url(r'^login$', 'login', {'template_name': 'login.html'}, url(r'^login$', 'login', {'template_name': 'login.html'},
......
...@@ -13,7 +13,7 @@ class BaseModel(models.Model): ...@@ -13,7 +13,7 @@ class BaseModel(models.Model):
class Course(BaseModel): class Course(BaseModel):
name = models.CharField(max_length = 150) name = models.CharField(max_length = 150)
slug = models.SlugField(max_length = 50, unique=True) courseSlug = models.SlugField(max_length = 50, unique=True)
# ordering # ordering
prerequisites = models.ManyToManyField('Course', related_name = 'prereqField', null=True) prerequisites = models.ManyToManyField('Course', related_name = 'prereqField', null=True)
...@@ -75,7 +75,7 @@ class CourseCollection(BaseModel): ...@@ -75,7 +75,7 @@ class CourseCollection(BaseModel):
class Program(BaseModel): class Program(BaseModel):
name = models.CharField(max_length = 150) name = models.CharField(max_length = 150)
# slug = models.SlugField(max_length = 50, unique = True) # programSlug = models.SlugField(max_length = 50, unique = True)
# courseCollections # courseCollections
courseReqs = models.ManyToManyField('CourseCollection',) courseReqs = models.ManyToManyField('CourseCollection',)
...@@ -137,7 +137,7 @@ post_save.connect(create_user_profile, sender=User) ...@@ -137,7 +137,7 @@ post_save.connect(create_user_profile, sender=User)
class Trajectory(BaseModel): class Trajectory(BaseModel):
name = models.CharField(max_length = 150) name = models.CharField(max_length = 150)
slug = models.SlugField(max_length = 50, unique = True) trajectorySlug = models.SlugField(max_length = 50, unique = True)
# Takes courses # Takes courses
previousCourses = models.ManyToManyField('Trajectory',) previousCourses = models.ManyToManyField('Trajectory',)
......
...@@ -10,13 +10,13 @@ urlpatterns = patterns('', ...@@ -10,13 +10,13 @@ urlpatterns = patterns('',
# url(r'^blog/', include('blog.urls')), # url(r'^blog/', include('blog.urls')),
# course # course
url(r'^course/(?P<courseName>\w+)/$', 'course', name = 'course'), url(r'^course/(?P<courseSlug>\w+)/$', 'course', name = 'course'),
# student's page # student's page
url(r'^user/(?P<username>\w+)/$', 'student', name = 'student'), url(r'^(?P<username>\w+)/$', 'student', name = 'student'),
# single trajectory page # single trajectory page
url(r'^user/(?P<username>\w+)/(?P<trajectoryslug>\w+)$', 'trajectory', name = 'trajectory'), url(r'^(?P<username>\w+)/(?P<trajectorySlug>\w+)$', 'trajectory', name = 'trajectory'),
# a new trajectory # a new trajectory
# url(r'^user/(?P<username>\w+)/new/$', 'new', name = 'new'), # url(r'^user/(?P<username>\w+)/new/$', 'new', name = 'new'),
...@@ -25,5 +25,4 @@ urlpatterns = patterns('', ...@@ -25,5 +25,4 @@ urlpatterns = patterns('',
# creating the trajectory # creating the trajectory
# url(r'^user/(?P<username>\w+)/create/$', 'create', name = 'create'), # url(r'^user/(?P<username>\w+)/create/$', 'create', name = 'create'),
url(r'^create/$', 'create', name = 'create'), url(r'^create/$', 'create', name = 'create'),
) )
...@@ -159,7 +159,7 @@ def student(request, slug): ...@@ -159,7 +159,7 @@ def student(request, slug):
# simply displays a page for the course # simply displays a page for the course
def course(request, slug): def course(request, slug):
course = get_object_or_404(Course, slug=slug) course = get_object_or_404(Course, slug=slug) #courseSlug
return render(request, 'course.html', { return render(request, 'course.html', {
'course' : course, 'course' : course,
...@@ -169,7 +169,7 @@ def course(request, slug): ...@@ -169,7 +169,7 @@ def course(request, slug):
# simply returns a page showing a program # simply returns a page showing a program
# @login_required # @login_required
def program (request): def program (request):
program = get_object_or_404(Program, slug=slug) program = get_object_or_404(Program, slug=slug) #programSlug
return render(request, 'program.html', { return render(request, 'program.html', {
'program' : program, 'program' : program,
...@@ -180,7 +180,7 @@ def program (request): ...@@ -180,7 +180,7 @@ def program (request):
# @login_required # @login_required
def trajectory(request, slug): def trajectory(request, slug):
# actually needs more than one slug, the one for the user # actually needs more than one slug, the one for the user
trajectory = get_object_or_404(Trajectory, slug=slug) trajectory = get_object_or_404(Trajectory, slug=slug) #trajectorySlug
return render(request, 'trajectory.html', { return render(request, 'trajectory.html', {
'trajectory' : trajectory, 'trajectory' : trajectory,
......
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