Revision 2556cf45 snf-astakos-app/astakos/im/models.py
b/snf-astakos-app/astakos/im/models.py | ||
---|---|---|
1481 | 1481 |
return presentation.PROJECT_MEMBER_LEAVE_POLICIES.get(policy) |
1482 | 1482 |
|
1483 | 1483 |
|
1484 |
class ProjectResourceGrantManager(models.Manager): |
|
1485 |
def grants_per_app(self, applications): |
|
1486 |
app_ids = [app.id for app in applications] |
|
1487 |
grants = self.filter( |
|
1488 |
project_application__in=app_ids).select_related("resource") |
|
1489 |
return _partition_by(lambda g: g.project_application_id, grants) |
|
1490 |
|
|
1491 |
|
|
1484 | 1492 |
class ProjectResourceGrant(models.Model): |
1485 | 1493 |
|
1486 | 1494 |
resource = models.ForeignKey(Resource) |
... | ... | |
1489 | 1497 |
project_capacity = intDecimalField(null=True) |
1490 | 1498 |
member_capacity = intDecimalField(default=0) |
1491 | 1499 |
|
1500 |
objects = ProjectResourceGrantManager() |
|
1501 |
|
|
1492 | 1502 |
class Meta: |
1493 | 1503 |
unique_together = ("resource", "project_application") |
1494 | 1504 |
|
Also available in: Unified diff