Commit 2740044dc3e6cee7598a66aca8c1861745a714df
1 parent
93f98dde
Exists in
master
and in
39 other branches
Fixing user profile charts
Showing
1 changed file
with
5 additions
and
11 deletions
Show diff stats
src/accounts/views.py
... | ... | @@ -9,7 +9,6 @@ from django.contrib import messages |
9 | 9 | from django.db.models import Count |
10 | 10 | from django.contrib.auth import get_user_model |
11 | 11 | from django.views.generic import DetailView, UpdateView |
12 | -from django.utils import timezone | |
13 | 12 | from django.utils.translation import ugettext as _ |
14 | 13 | from django.shortcuts import render, redirect |
15 | 14 | from django.core.urlresolvers import reverse |
... | ... | @@ -52,28 +51,23 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): |
52 | 51 | context = {} |
53 | 52 | |
54 | 53 | count_types = OrderedDict() |
55 | - six_months = timezone.now() - datetime.timedelta(days=180) | |
56 | 54 | |
57 | 55 | fields_or_lookup = ( |
58 | 56 | {'collaborators__contains': user.username}, |
59 | - {'author': user.username}, | |
57 | + {'author_and_username__contains': user.username}, | |
60 | 58 | ) |
61 | 59 | |
62 | - | |
63 | 60 | for type in ['thread', 'ticket', 'wiki', 'changeset', 'attachment']: |
64 | - sqs = SearchQuerySet().filter( | |
65 | - type=type, | |
66 | - modified__gte=six_months, | |
67 | - ) | |
61 | + sqs = SearchQuerySet() | |
68 | 62 | for filter_or in fields_or_lookup: |
69 | - sqs = sqs.filter_or(**filter_or) | |
63 | + sqs = sqs.filter_or(type=type, **filter_or) | |
70 | 64 | count_types[trans(type)] = sqs.count() |
71 | 65 | |
72 | 66 | context['type_count'] = count_types |
73 | 67 | |
74 | - sqs = SearchQuerySet().exclude(type='thread') | |
68 | + sqs = SearchQuerySet() | |
75 | 69 | for filter_or in fields_or_lookup: |
76 | - sqs = sqs.filter_or(**filter_or) | |
70 | + sqs = sqs.filter_or(**filter_or).exclude(type='thread') | |
77 | 71 | |
78 | 72 | context['results'] = sqs.order_by('-modified', '-created')[:10] |
79 | 73 | ... | ... |