~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-23 08:48:09 UTC
  • mfrom: (1673 trunk)
  • mto: This revision was merged to the branch mainline in revision 1674.
  • Revision ID: grantw@unimelb.edu.au-20100223084809-du6dvsxrjhw15ytr
Merge trunk.

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
 
    Offering, ProjectSet, Project, Semester, Subject, User)
 
21
    Enrolment, Offering, ProjectSet, Project, Semester, Subject, User)
22
22
 
23
23
from ivle.webapp import ApplicationRoot
24
24
from ivle.webapp.publisher import ROOT
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
 
62
69
@reverse_route(User)
63
70
def user_url(user):
64
71
    return (ROOT, '~' + user.login)
83
90
@reverse_route(Project)
84
91
def project_url(project):
85
92
    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))