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

« back to all changes in this revision

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

  • Committer: William Grant
  • Date: 2009-12-07 11:01:50 UTC
  • mfrom: (1341.1.3 trunk)
  • Revision ID: grantw@unimelb.edu.au-20091207110150-jct30a9yru432ddn
Fix up the project set creation UI a bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    
31
31
    Add new, delete, edit functionality is given here."""
32
32
    template = "templates/projectset_fragment.html"
 
33
    
 
34
    def __init__(self, req, subject, year, semester, projectset):
 
35
        self.context = req.store.find(ProjectSet,
 
36
            ProjectSet.id == int(projectset),
 
37
            ProjectSet.offering_id == Offering.id,
 
38
            Offering.subject_id == Subject.id,
 
39
            Subject.short_name == unicode(subject),
 
40
            Offering.semester_id == Semester.id,
 
41
            Semester.year == unicode(year),
 
42
            Semester.semester == unicode(semester)).one()
 
43
        
 
44
        if self.context is None:
 
45
            raise NotFound()
33
46
 
34
47
    def _project_url(self, project):
35
48
        return "/subjects/%s/%s/%s/+projects/%s" % \
55
68
        req.store.flush()
56
69
    
57
70
        self.template = "templates/project_fragment.html"
58
 
        self.ctx['req'] = req
59
71
        self.ctx['project'] = new_project
 
72
        self.ctx['project_url'] = self._project_url(new_project)
60
73
 
61
74
        return {'success': True, 'projectset_id': self.context.id}
 
75
 
 
76
class ProjectRESTView(XHTMLRESTView):
 
77
    """Rest view for a project."""