def _populate_history(self, user):
     """Store the latest action log items for the specified team."""
     entries = LogEntry.objects.by_user(user)[:12]
     r = TxRedisMapper()
     key = redis_key_for_user(user)
     for entry in entries:
         data = {
             'action_time': entry.action_time,
             'message': entry.message,
             'action_type': entry.action_type,
             'user': entry.user.username
         }
         r.rpush(key, data=data)
     r.ltrim(key, 0, 11)
 def _populate_history(self, resource):
     """Store the latest action log items for the specified resources."""
     Resource = get_model('resources', 'Resource')
     entries = LogEntry.objects.filter(
         content_type=ContentType.objects.get_for_model(Resource),
         object_id=resource.id)[:5]
     r = TxRedisMapper()
     key = redis_key_for_resource(resource)
     for entry in entries:
         data = {
             'action_time': entry.action_time,
             'message': entry.message,
             'action_type': entry.action_type,
         }
         r.rpush(key, data=data)
     r.ltrim(key, 0, 4)
Пример #3
0
 def _populate_history(self, team):
     """Store the latest action log items for the specified team."""
     Team = get_model('teams', 'Team')
     entries = LogEntry.objects.filter(
         content_type=ContentType.objects.get_for_model(Team),
         object_id=team.id)[:5]
     r = TxRedisMapper()
     key = redis_key_for_team(team)
     for entry in entries:
         data = {
             'action_time': entry.action_time,
             'message': entry.message,
             'action_type': entry.action_type,
         }
         r.rpush(key, data=data)
     r.ltrim(key, 0, 4)
Пример #4
0
 def _populate_history(self, resource):
     """Store the latest action log items for the specified resources."""
     Resource = get_model('resources', 'Resource')
     entries = LogEntry.objects.filter(
         content_type=ContentType.objects.get_for_model(Resource),
         object_id=resource.id
     )[:5]
     r = TxRedisMapper()
     key = redis_key_for_resource(resource)
     for entry in entries:
         data = {
             'action_time': entry.action_time,
             'message': entry.message,
             'action_type': entry.action_type,
         }
         r.rpush(key, data=data)
     r.ltrim(key, 0, 4)
Пример #5
0
 def _populate_history(self, team):
     """Store the latest action log items for the specified team."""
     Team = get_model('teams', 'Team')
     entries = LogEntry.objects.filter(
         content_type=ContentType.objects.get_for_model(Team),
         object_id=team.id
     )[:5]
     r = TxRedisMapper()
     key = redis_key_for_team(team)
     for entry in entries:
         data = {
             'action_time': entry.action_time,
             'message': entry.message,
             'action_type': entry.action_type,
         }
         r.rpush(key, data=data)
     r.ltrim(key, 0, 4)
 def _populate_history(self, project):
     """Store the latest action log items for the specified project."""
     ids = [project.id]
     if project.is_hub:
         ids += project.outsourcing.all().values_list('id', flat=True)
     entries = LogEntry.objects.filter(
         content_type=ContentType.objects.get_for_model(Project),
         object_id__in=ids)[:5]
     r = TxRedisMapper()
     key = redis_key_for_project(project)
     for entry in entries:
         data = {
             'action_time': entry.action_time,
             'message': entry.message,
             'action_type': entry.action_type
         }
         r.rpush(key, data=data)
     r.ltrim(key, 0, 4)
Пример #7
0
 def _populate_history(self, project):
     """Store the latest action log items for the specified project."""
     ids = [project.id]
     if project.is_hub:
         ids += project.outsourcing.all().values_list('id', flat=True)
     entries = LogEntry.objects.filter(
         content_type=ContentType.objects.get_for_model(Project),
         object_id__in=ids
     )[:5]
     r = TxRedisMapper()
     key = redis_key_for_project(project)
     for entry in entries:
         data = {
             'action_time': entry.action_time,
             'message': entry.message,
             'action_type': entry.action_type
         }
         r.rpush(key, data=data)
     r.ltrim(key, 0, 4)