diff --git a/core/templates/core/group_detail.jinja b/core/templates/core/group_detail.jinja new file mode 100644 index 00000000..58ec1f89 --- /dev/null +++ b/core/templates/core/group_detail.jinja @@ -0,0 +1,18 @@ +{% extends "core/base.jinja" %} + +{% block title %} + {% trans %}Group detail{% endtrans %} +{% endblock title %} + +{% block content %} +

{% trans %}Back to list{% endtrans %}

+ {% if not object.users.exists() %} +

{% trans %}No user in this group{% endtrans %}

+ {% else %} + + {% endif %} +{% endblock content %} \ No newline at end of file diff --git a/core/templates/core/group_list.jinja b/core/templates/core/group_list.jinja index 79bb5de4..e1e926bb 100644 --- a/core/templates/core/group_list.jinja +++ b/core/templates/core/group_list.jinja @@ -7,11 +7,21 @@ {% block content %}

{% trans %}Group list{% endtrans %}

{% trans %}New group{% endtrans %}

- + + + + + + + {% for group in object_list %} + + + + + + + + {% endfor %} +
{% trans %}ID{% endtrans %}{% trans %}Group{% endtrans %}{% trans %}Description{% endtrans %}
{{ group.id }}{{ group }}{{ group.description }}{% trans %}Edit{% endtrans %}{% trans %}Delete{% endtrans %}
{% endblock %} diff --git a/core/urls.py b/core/urls.py index be18ff8e..21398841 100644 --- a/core/urls.py +++ b/core/urls.py @@ -64,6 +64,11 @@ urlpatterns = [ GroupDeleteView.as_view(), name="group_delete", ), + url( + r"^group/(?P[0-9]+)/detail$", + GroupDetailView.as_view(), + name="group_detail", + ), # User views url(r"^user/$", UserListView.as_view(), name="user_list"), url( diff --git a/core/views/group.py b/core/views/group.py index 29864dbc..fb1f7996 100644 --- a/core/views/group.py +++ b/core/views/group.py @@ -23,7 +23,7 @@ # 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 core.models import RealGroup @@ -36,6 +36,7 @@ class GroupListView(CanEditMixin, ListView): """ model = RealGroup + ordering = ["name"] template_name = "core/group_list.jinja" @@ -52,6 +53,12 @@ class GroupCreateView(CanEditMixin, CreateView): fields = ["name", "description"] +class GroupDetailView(CanEditMixin, DetailView): + model = RealGroup + pk_url_kwarg = "group_id" + template_name = "core/group_detail.jinja" + + class GroupDeleteView(CanEditMixin, DeleteView): model = RealGroup pk_url_kwarg = "group_id"