Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
9d79ffb5
Commit
9d79ffb5
authored
May 03, 2018
by
Hugo LEVY-FALK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plus de BÔTÉ dans l'affichage des superusers
parent
8a199777
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
logs/templates/logs/aff_stats_droits.html
logs/templates/logs/aff_stats_droits.html
+5
-1
logs/views.py
logs/views.py
+7
-2
users/forms.py
users/forms.py
+1
-1
No files found.
logs/templates/logs/aff_stats_droits.html
View file @
9d79ffb5
...
@@ -66,7 +66,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
...
@@ -66,7 +66,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td><p
class=
"text-success"
>
{{utilisateur.last}}
</p></td>
<td><p
class=
"text-success"
>
{{utilisateur.last}}
</p></td>
{% endif %}
{% endif %}
<td>
<td>
{% if droit != 'Superuser' %}
<a
href=
"{% url 'users:del-group' utilisateur.id droit.id %}"
>
<a
href=
"{% url 'users:del-group' utilisateur.id droit.id %}"
>
{% else %}
<a
href=
"{% url 'users:del-superuser' utilisateur.id %}"
>
{% endif %}
<button
type=
"button"
class=
"btn btn-danger"
aria-label=
"Left Align"
>
<button
type=
"button"
class=
"btn btn-danger"
aria-label=
"Left Align"
>
<span
class=
"fa fa-user-times"
aria-hidden=
"true"
></span>
<span
class=
"fa fa-user-times"
aria-hidden=
"true"
></span>
</button>
</button>
...
@@ -79,4 +83,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
...
@@ -79,4 +83,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
\ No newline at end of file
logs/views.py
View file @
9d79ffb5
...
@@ -41,7 +41,7 @@ from django.urls import reverse
...
@@ -41,7 +41,7 @@ from django.urls import reverse
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
from
django.contrib
import
messages
from
django.contrib
import
messages
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
from
django.db.models
import
Count
,
Max
from
django.db.models
import
Count
,
Max
,
F
from
reversion.models
import
Revision
from
reversion.models
import
Revision
from
reversion.models
import
Version
,
ContentType
from
reversion.models
import
Version
,
ContentType
...
@@ -469,9 +469,14 @@ def stats_droits(request):
...
@@ -469,9 +469,14 @@ def stats_droits(request):
for
droit
in
ListRight
.
objects
.
all
().
select_related
(
'group_ptr'
):
for
droit
in
ListRight
.
objects
.
all
().
select_related
(
'group_ptr'
):
stats_list
[
droit
]
=
droit
.
user_set
.
all
().
annotate
(
stats_list
[
droit
]
=
droit
.
user_set
.
all
().
annotate
(
num
=
Count
(
'revision'
),
num
=
Count
(
'revision'
),
last
=
Max
(
'revision__date_created'
)
last
=
Max
(
'revision__date_created'
)
,
)
)
stats_list
[
'Superuser'
]
=
User
.
objects
.
filter
(
is_superuser
=
True
).
annotate
(
num
=
Count
(
'revision'
),
last
=
Max
(
'revision__date_created'
),
)
return
render
(
return
render
(
request
,
request
,
'logs/stats_droits.html'
,
'logs/stats_droits.html'
,
...
...
users/forms.py
View file @
9d79ffb5
...
@@ -457,7 +457,7 @@ class GroupForm(FormRevMixin, ModelForm):
...
@@ -457,7 +457,7 @@ class GroupForm(FormRevMixin, ModelForm):
class
Meta
:
class
Meta
:
model
=
User
model
=
User
fields
=
[
'
groups'
,
'is_superuser
'
]
fields
=
[
'
is_superuser'
,
'groups
'
]
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
prefix
=
kwargs
.
pop
(
'prefix'
,
self
.
Meta
.
model
.
__name__
)
prefix
=
kwargs
.
pop
(
'prefix'
,
self
.
Meta
.
model
.
__name__
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment