Revision 764d99c4 snf-astakos-app/astakos/im/quotas.py

b/snf-astakos-app/astakos/im/quotas.py
152 152
    return True, None
153 153

  
154 154

  
155
def add_base_quota(user, resource, capacity):
156
    resource = Resource.objects.get(name=resource)
157
    obj, created = AstakosUserQuota.objects.get_or_create(
158
        user=user, resource=resource, defaults={
159
            'capacity': capacity,
160
        })
161

  
162
    if not created:
163
        obj.capacity = capacity
164
        obj.save()
165
    qh_sync_user(user.id)
166

  
167

  
168
def remove_base_quota(user, resource):
169
    AstakosUserQuota.objects.filter(
170
        user=user, resource__name=resource).delete()
171
    qh_sync_user(user.id)
172

  
173

  
155 174
def initial_quotas(users):
156 175
    initial = {}
157 176
    default_quotas = get_default_quota()

Also available in: Unified diff