mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Group management enhacement
This commit is contained in:
parent
a6f76f5279
commit
f6553a8f52
18
core/templates/core/group_detail.jinja
Normal file
18
core/templates/core/group_detail.jinja
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{% extends "core/base.jinja" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans %}Group detail{% endtrans %}
|
||||||
|
{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p><a href="{{ url('core:group_list') }}">{% trans %}Back to list{% endtrans %}</a></p>
|
||||||
|
{% if not object.users.exists() %}
|
||||||
|
<p>{% trans %}No user in this group{% endtrans %}</p>
|
||||||
|
{% else %}
|
||||||
|
<ul>
|
||||||
|
{% for user in object.users.all() %}
|
||||||
|
<li><a href="{{ url('core:user_profile', user.id) }}">{{ user }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock content %}
|
@ -7,11 +7,21 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>{% trans %}Group list{% endtrans %}</h3>
|
<h3>{% trans %}Group list{% endtrans %}</h3>
|
||||||
<p><a href="{{ url('core:group_new') }}">{% trans %}New group{% endtrans %}</a></p>
|
<p><a href="{{ url('core:group_new') }}">{% trans %}New group{% endtrans %}</a></p>
|
||||||
<ul>
|
<table>
|
||||||
{% for g in realgroup_list %}
|
<tr>
|
||||||
<li><a href="{{ url('core:group_edit', group_id=g.id) }}">{{ g.name }}</a> - {{ g.description }} -
|
<th>{% trans %}ID{% endtrans %}</th>
|
||||||
<a href="{{ url('core:group_delete', group_id=g.id) }}">{% trans %}Delete{% endtrans %}</a></li>
|
<th>{% trans %}Group{% endtrans %}</th>
|
||||||
{% endfor %}
|
<th>{% trans %}Description{% endtrans %}</th>
|
||||||
</ul>
|
</tr>
|
||||||
|
{% for group in object_list %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ group.id }}</td>
|
||||||
|
<td><a href="{{ url('core:group_detail', group.id) }}">{{ group }}</a></td>
|
||||||
|
<td>{{ group.description }}</td>
|
||||||
|
<td><a href="{{ url('core:group_edit', group.id) }}">{% trans %}Edit{% endtrans %}</a></td>
|
||||||
|
<td><a href="{{ url('core:group_delete', group.id) }}">{% trans %}Delete{% endtrans %}</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -64,6 +64,11 @@ urlpatterns = [
|
|||||||
GroupDeleteView.as_view(),
|
GroupDeleteView.as_view(),
|
||||||
name="group_delete",
|
name="group_delete",
|
||||||
),
|
),
|
||||||
|
url(
|
||||||
|
r"^group/(?P<group_id>[0-9]+)/detail$",
|
||||||
|
GroupDetailView.as_view(),
|
||||||
|
name="group_detail",
|
||||||
|
),
|
||||||
# User views
|
# User views
|
||||||
url(r"^user/$", UserListView.as_view(), name="user_list"),
|
url(r"^user/$", UserListView.as_view(), name="user_list"),
|
||||||
url(
|
url(
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
from django.views.generic.edit import UpdateView, CreateView, DeleteView
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView, DetailView
|
||||||
from django.core.urlresolvers import reverse_lazy
|
from django.core.urlresolvers import reverse_lazy
|
||||||
|
|
||||||
from core.models import RealGroup
|
from core.models import RealGroup
|
||||||
@ -36,6 +36,7 @@ class GroupListView(CanEditMixin, ListView):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
model = RealGroup
|
model = RealGroup
|
||||||
|
ordering = ["name"]
|
||||||
template_name = "core/group_list.jinja"
|
template_name = "core/group_list.jinja"
|
||||||
|
|
||||||
|
|
||||||
@ -52,6 +53,12 @@ class GroupCreateView(CanEditMixin, CreateView):
|
|||||||
fields = ["name", "description"]
|
fields = ["name", "description"]
|
||||||
|
|
||||||
|
|
||||||
|
class GroupDetailView(CanEditMixin, DetailView):
|
||||||
|
model = RealGroup
|
||||||
|
pk_url_kwarg = "group_id"
|
||||||
|
template_name = "core/group_detail.jinja"
|
||||||
|
|
||||||
|
|
||||||
class GroupDeleteView(CanEditMixin, DeleteView):
|
class GroupDeleteView(CanEditMixin, DeleteView):
|
||||||
model = RealGroup
|
model = RealGroup
|
||||||
pk_url_kwarg = "group_id"
|
pk_url_kwarg = "group_id"
|
||||||
|
Loading…
Reference in New Issue
Block a user