~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/publishing.py

  • Committer: William Grant
  • Date: 2010-02-15 09:16:49 UTC
  • Revision ID: grantw@unimelb.edu.au-20100215091649-qrp5emn7wjt2jlmj
Add 'Create new offering' link to /subjects, and rebrand the 'Manage subjects' link to include semesters too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from storm.locals import Store
19
19
 
20
20
from ivle.database import (
21
 
    Enrolment, Offering, ProjectSet, Project, Semester, Subject, User)
 
21
    Offering, ProjectSet, Project, Semester, Subject, User)
22
22
 
23
23
from ivle.webapp import ApplicationRoot
24
24
from ivle.webapp.publisher import ROOT
36
36
 
37
37
@forward_route(ApplicationRoot, '+semesters', argc=2)
38
38
def root_to_semester(root, year, semester):
39
 
    return root.store.find(Semester, year=year, url_name=semester).one()
 
39
    return root.store.find(Semester, year=year, semester=semester).one()
40
40
 
41
41
@forward_route(Subject, argc=2)
42
42
def subject_to_offering(subject, year, semester):
59
59
                                   ProjectSet.id == ps_id,
60
60
                                   ProjectSet.offering == offering).one()
61
61
 
62
 
@forward_route(Offering, '+enrolments', argc=1)
63
 
def offering_to_enrolment(offering, login):
64
 
    return Store.of(offering).find(Enrolment,
65
 
                                   Enrolment.offering == offering,
66
 
                                   Enrolment.user_id == User.id,
67
 
                                   User.login == login).one()
68
 
 
69
62
@reverse_route(User)
70
63
def user_url(user):
71
64
    return (ROOT, '~' + user.login)
76
69
 
77
70
@reverse_route(Semester)
78
71
def semester_url(semester):
79
 
    return (ROOT, ('+semesters', semester.year, semester.url_name))
 
72
    return (ROOT, ('+semesters', semester.year, semester.semester))
80
73
 
81
74
@reverse_route(Offering)
82
75
def offering_url(offering):
83
76
    return (offering.subject, (offering.semester.year,
84
 
                               offering.semester.url_name))
 
77
                               offering.semester.semester))
85
78
 
86
79
@reverse_route(ProjectSet)
87
80
def projectset_url(project_set):
90
83
@reverse_route(Project)
91
84
def project_url(project):
92
85
    return (project.project_set.offering, ('+projects', project.short_name))
93
 
 
94
 
@reverse_route(Enrolment)
95
 
def enrolment_url(enrolment):
96
 
    return (enrolment.offering, ('+enrolments', enrolment.user.login))