Revision 890c2065 snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
301 301
    def verified(self):
302 302
        return self.filter(email_verified=True)
303 303

  
304
    def uuid_catalog(self, l=None):
305
        """
306
        Returns a uuid to username mapping for the uuids appearing in l.
307
        If l is None returns the mapping for all existing users.
308
        """
309
        q = self.filter(uuid__in=l) if l != None else self
310
        return dict(q.values_list('uuid', 'username'))
311

  
312
    def displayname_catalog(self, l=None):
313
        """
314
        Returns a username to uuid mapping for the usernames appearing in l.
315
        If l is None returns the mapping for all existing users.
316
        """
317
        q = self.filter(uuid__in=l) if l != None else self
318
        q = self.filter(username__in=l) if l != None else self
319
        return dict(q.values_list('username', 'uuid'))
320

  
321

  
304 322

  
305 323
class AstakosUser(User):
306 324
    """

Also available in: Unified diff