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
rp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
rpteam
rp
Commits
777536fa
Verified
Commit
777536fa
authored
Oct 18, 2017
by
Thibaut Broggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a list of users on route /user
parent
9423f034
Pipeline
#1430
passed with stages
in 1 minute and 49 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
apps/rp/templates/rp/user_list.html
apps/rp/templates/rp/user_list.html
+54
-0
apps/rp/urls.py
apps/rp/urls.py
+6
-0
apps/rp/views/users.py
apps/rp/views/users.py
+15
-0
No files found.
apps/rp/templates/rp/user_list.html
0 → 100644
View file @
777536fa
{% extends "base.html" %}
{% block content-header %}
{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-md-12 white-bg"
>
{% if is_paginated %}
<div
class=
"pagination"
>
<span
class=
"page-links"
>
{% if page_obj.has_previous %}
<a
href=
"?page={{ page_obj.previous_page_number }}"
><i
class=
"fa fa-chevron-left"
aria-hidden=
"true"
></i></a>
{% endif %}
<span
class=
"page-current"
>
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
</span>
{% if page_obj.has_next %}
<a
href=
"?page={{ page_obj.next_page_number }}"
><i
class=
"fa fa-chevron-right"
aria-hidden=
"true"
></i></a>
{% endif %}
</span>
</div>
{% endif %}
<table
class=
"article-table table table-sm my-4"
>
<thead>
<tr>
<th>
ID
</th>
<th>
Username
</th>
<th>
Email
</th>
<th>
Registration date
</th>
<th>
Role
</th>
<th>
Actions
<img
class=
"inline-image ml-2"
role=
"img"
src=
"{% static 'img/jedi.svg' %}"
/></th>
</tr>
</thead>
<tbody>
{% for article in object_list|slice:":10" %}
<tr
id=
"row_{{article.id}}"
>
<td>
{{article.id}}
</td>
<td>
{{article.username}}
</td>
<td>
{{article.email}}
</td>
<td>
{{article.date_joined |date:'d/m/Y - H:i:s'}}
</td>
<td>
{{article.groups.all.0.name}}
</td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
apps/rp/urls.py
View file @
777536fa
...
...
@@ -2,6 +2,7 @@ from django.contrib.auth.decorators import login_required
from
django.conf.urls
import
url
from
rp.views.articles
import
ArticleListFlux
,
ArticleEdit
,
ArticleDetailView
,
ArticleList
from
rp.views.users
import
UserListView
urlpatterns
=
[
url
(
...
...
@@ -43,5 +44,10 @@ urlpatterns = [
r
"^article/preview/(?P<pk>\d+)"
,
login_required
(
ArticleDetailView
.
as_view
(
preview
=
True
)),
name
=
"article-preview"
),
url
(
r
"^user"
,
login_required
(
UserListView
.
as_view
()),
name
=
"user-list"
)
]
apps/rp/views/users.py
0 → 100644
View file @
777536fa
from
django.contrib.auth.models
import
User
from
django.views.generic.list
import
ListView
class
UserListView
(
ListView
):
paginate_by
=
10
template_name
=
"rp/user_list.html"
def
get_queryset
(
self
):
return
User
.
objects
.
all
()
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
return
context
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