430
430
return "<%s %s in %r>" % (type(self).__name__, self.name,
431
431
self.project_set.offering)
433
def get_projects(self, offering=None, active_only=True):
434
'''Return Projects that the group can submit.
436
This will include projects in the project set which owns this group,
437
unless the project set disallows groups (in which case none will be
440
Unless active_only is False, projects will only be returned if the
441
group's offering is active.
443
If an offering is specified, projects will only be returned if it
446
return Store.of(self).find(Project,
447
Project.project_set_id == ProjectSet.id,
448
ProjectSet.id == self.project_set.id,
449
ProjectSet.max_students_per_group > 0,
450
ProjectSet.offering_id == Offering.id,
451
(offering is None) or (Offering.id == offering.id),
452
Semester.id == Offering.semester_id,
453
(not active_only) or (Semester.state == u'current'))
433
456
def get_permissions(self, user):
434
457
if user.admin or user in self.members:
435
458
return set(['submit_project'])