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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: William Grant
  • Date: 2010-02-15 10:09:00 UTC
  • Revision ID: grantw@unimelb.edu.au-20100215100900-1gp5wy3yrduxt9bq
Add UI to clone worksheets between offerings -- replacing ivle-cloneworksheets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
425
425
        # XXX: Respect extensions.
426
426
        return self.projects.find(Project.deadline > datetime.datetime.now())
427
427
 
 
428
    def clone_worksheets(self, source):
 
429
        """Clone all worksheets from the specified source to this offering."""
 
430
        import ivle.worksheet.utils
 
431
        for worksheet in source.worksheets:
 
432
            newws = Worksheet()
 
433
            newws.seq_no = worksheet.seq_no
 
434
            newws.identifier = worksheet.identifier
 
435
            newws.name = worksheet.name
 
436
            newws.assessable = worksheet.assessable
 
437
            newws.data = worksheet.data
 
438
            newws.format = worksheet.format
 
439
            newws.offering = self
 
440
            Store.of(self).add(newws)
 
441
            ivle.worksheet.utils.update_exerciselist(newws)
 
442
 
 
443
 
428
444
class Enrolment(Storm):
429
445
    """An enrolment of a user in an offering.
430
446