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

« back to all changes in this revision

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

  • Committer: David Coles
  • Date: 2009-08-03 00:32:10 UTC
  • mto: (1294.2.119 ui-the-third)
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: coles.david@gmail.com-20090803003210-65k1ht95rkkkqujv
Fix Console breakage due to ConsoleView's class varibiles being overwritten by the parent class' init function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import ivle.database
4
4
from ivle.database import ProjectSet, Subject, Semester, Offering
5
5
 
6
 
from ivle.webapp.admin.projectservice import ProjectSetRESTView
7
 
from ivle.webapp.groups import GroupsView
8
6
from ivle.webapp.base.rest import (XHTMLRESTView, named_operation,
9
7
                                   require_permission)
 
8
 
10
9
from ivle.webapp.errors import NotFound
11
10
 
12
11
class OfferingRESTView(XHTMLRESTView):
16
15
 
17
16
    template = "subject.html"
18
17
 
 
18
    def new_project_url(self, projectset):
 
19
        return "/api/subjects/" + str(self.context.subject.id) + "/" +\
 
20
               self.context.semester.year + "/" +\
 
21
               self.context.semester.semester + "/+projectsets/" +\
 
22
               (str(projectset.id)) + "/+projects/+new"
 
23
 
19
24
    @named_operation('edit')
20
25
    def add_projectset(self, req, group_size):
21
26
        """Add a new ProjectSet"""
29
34
        req.store.add(new_projectset)
30
35
        req.store.flush()
31
36
 
32
 
        self.ctx['req'] = req
33
37
        self.ctx['projectset'] = new_projectset
34
38
        self.ctx['projects'] = []
35
 
        self.ctx['GroupsView'] = GroupsView
36
 
        self.ctx['ProjectSetRESTView'] = ProjectSetRESTView
 
39
        self.ctx['new_project_url'] = self.new_project_url(new_projectset)
37
40
 
38
41
        self.template = 'templates/projectset_fragment.html'
39
42