Revision f72ba65d snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
519 519
        return self.astakosuserquota_set.select_related().all()
520 520

  
521 521
    def get_resource_policy(self, resource):
522
        resource = Resource.objects.get(name=resource)
523
        default_capacity = resource.uplimit
524
        try:
525
            policy = AstakosUserQuota.objects.get(user=self, resource=resource)
526
            return policy, default_capacity
527
        except AstakosUserQuota.DoesNotExist:
528
            return None, default_capacity
522
        return AstakosUserQuota.objects.select_related("resource").\
523
            get(user=self, resource__name=resource)
529 524

  
530 525
    def update_uuid(self):
531 526
        while not self.uuid:

Also available in: Unified diff