File tree Expand file tree Collapse file tree 5 files changed +23
-31
lines changed Expand file tree Collapse file tree 5 files changed +23
-31
lines changed Original file line number Diff line number Diff line change @@ -191,11 +191,7 @@ class ProfileView(LoginRequiredMixin, View):
191
191
def get (self , request ):
192
192
193
193
# Compile changelog table
194
- changelog = ObjectChange .objects .valid_models ().restrict (request .user , 'view' ).filter (
195
- user = request .user
196
- ).prefetch_related (
197
- 'changed_object_type'
198
- )[:20 ]
194
+ changelog = ObjectChange .objects .valid_models ().restrict (request .user , 'view' ).filter (user = request .user )[:20 ]
199
195
changelog_table = ObjectChangeTable (changelog )
200
196
changelog_table .orderable = False
201
197
changelog_table .configure (request )
Original file line number Diff line number Diff line change 1
1
{% extends 'account/base.html' %}
2
- {% load helpers %}
3
- {% load render_table from django_tables2 %}
4
2
{% load i18n %}
5
3
6
4
{% block title %}{% trans "User Profile" %}{% endblock %}
7
5
8
6
{% block content %}
9
- < div class ="row mb-3 ">
7
+ < div class ="row ">
10
8
< div class ="col-md-6 ">
11
9
< div class ="card ">
12
10
< h2 class ="card-header "> {% trans "Account Details" %}</ h2 >
@@ -64,19 +62,7 @@ <h2 class="card-header">{% trans "Assigned Groups" %}</h2>
64
62
{% if perms.core.view_objectchange %}
65
63
< div class ="row ">
66
64
< div class ="col-md-12 ">
67
- < div class ="card ">
68
- < h2 class ="card-header text-center ">
69
- {% trans "Recent Activity" %}
70
- < div class ="card-actions ">
71
- < a href ="{% url 'core:objectchange_list' %}?user_id={{ request.user.pk }} " class ="btn btn-ghost-primary btn-sm ">
72
- < i class ="mdi mdi-arrow-right-thick " aria-hidden ="true "> </ i > {% trans "View All" %}
73
- </ a >
74
- </ div >
75
- </ h2 >
76
- < div class ="table-responsive ">
77
- {% render_table changelog_table 'inc/table.html' %}
78
- </ div >
79
- </ div >
65
+ {% include 'users/inc/user_activity.html' with user=user table=changelog_table %}
80
66
</ div >
81
67
</ div >
82
68
{% endif %}
Original file line number Diff line number Diff line change
1
+ {% load i18n %}
2
+ {% load render_table from django_tables2 %}
3
+
4
+ < div class ="card ">
5
+ < h2 class ="card-header text-center ">
6
+ {% trans "Recent Activity" %}
7
+ < div class ="card-actions ">
8
+ < a href ="{% url 'core:objectchange_list' %}?user_id={{ user.pk }} " class ="btn btn-ghost-primary btn-sm ">
9
+ < i class ="mdi mdi-arrow-right-thick " aria-hidden ="true "> </ i > {% trans "View All" %}
10
+ </ a >
11
+ </ div >
12
+ </ h2 >
13
+ < div class ="table-responsive ">
14
+ {% render_table table 'inc/table.html' %}
15
+ </ div >
16
+ </ div >
Original file line number Diff line number Diff line change 1
1
{% extends 'generic/object.html' %}
2
2
{% load i18n %}
3
- {% load helpers %}
4
- {% load render_table from django_tables2 %}
5
3
6
4
{% block title %}{% trans "User" %} {{ object.username }}{% endblock %}
7
5
8
6
{% block subtitle %}{% endblock %}
9
7
10
8
{% block content %}
11
- < div class ="row mb-3 ">
9
+ < div class ="row ">
12
10
< div class ="col-md-6 ">
13
11
< div class ="card ">
14
12
< h2 class ="card-header "> {% trans "User" %}</ h2 >
@@ -74,12 +72,7 @@ <h2 class="card-header">{% trans "Assigned Permissions" %}</h2>
74
72
{% if perms.core.view_objectchange %}
75
73
< div class ="row ">
76
74
< div class ="col-md-12 ">
77
- < div class ="card ">
78
- < h2 class ="text-center "> {% trans "Recent Activity" %}</ h2 >
79
- < div class ="card-body table-responsive ">
80
- {% render_table changelog_table 'inc/table.html' %}
81
- </ div >
82
- </ div >
75
+ {% include 'users/inc/user_activity.html' with user=object table=changelog_table %}
83
76
</ div >
84
77
</ div >
85
78
{% endif %}
Original file line number Diff line number Diff line change @@ -75,8 +75,9 @@ class UserView(generic.ObjectView):
75
75
template_name = 'users/user.html'
76
76
77
77
def get_extra_context (self , request , instance ):
78
- changelog = ObjectChange .objects .restrict (request .user , 'view' ).filter (user = instance )[:20 ]
78
+ changelog = ObjectChange .objects .valid_models (). restrict (request .user , 'view' ).filter (user = instance )[:20 ]
79
79
changelog_table = ObjectChangeTable (changelog )
80
+ changelog_table .orderable = False
80
81
changelog_table .configure (request )
81
82
82
83
return {
You can’t perform that action at this time.
0 commit comments