Commit 8a8b6dd75e85c0b48c216ef8eb0b89e0c3e5abc6

Authored by Zambom
1 parent 5b5d6594

Log adjustements (admin visualization & chat participants context missing)

Showing 2 changed files with 8 additions and 5 deletions   Show diff stats
chat/views.py
... ... @@ -141,6 +141,12 @@ class SubjectParticipants(LoginRequiredMixin, LogMixin, generic.ListView):
141 141 def get_context_data(self, **kwargs):
142 142 context = super(SubjectParticipants, self).get_context_data(**kwargs)
143 143  
  144 + sub = self.kwargs.get('subject', 0)
  145 + subject = get_object_or_404(Subject, id = sub)
  146 +
  147 + self.log_context['subject_id'] = subject.id
  148 + self.log_context['subject_name'] = subject.name
  149 + self.log_context['subject_slug'] = subject.slug
144 150 self.log_context['search_by'] = self.request.GET.get('search', '')
145 151 self.log_context['timestamp_start'] = str(int(time.time()))
146 152  
... ... @@ -148,9 +154,6 @@ class SubjectParticipants(LoginRequiredMixin, LogMixin, generic.ListView):
148 154  
149 155 self.request.session['log_id'] = Log.objects.latest('id').id
150 156  
151   - sub = self.kwargs.get('subject', 0)
152   - subject = get_object_or_404(Subject, id = sub)
153   -
154 157 context['subject'] = subject
155 158 context['search'] = self.request.GET.get('search', '')
156 159 context['title'] = _('%s - Participants')%(str(subject))
... ...
log/admin.py
... ... @@ -3,7 +3,7 @@ from django.contrib import admin
3 3 from .models import Log
4 4  
5 5 class LogAdmin(admin.ModelAdmin):
6   - list_display = ['datetime', 'user', 'user_email', 'action', 'resource', 'context']
7   - search_fields = ['user', 'action', 'resource']
  6 + list_display = ['datetime', 'user', 'user_email', 'component', 'action', 'resource', 'context']
  7 + search_fields = ['user', 'component', 'action', 'resource']
8 8  
9 9 admin.site.register(Log, LogAdmin)
10 10 \ No newline at end of file
... ...