Allow jedi to delete users

parent 63a62a47
Pipeline #1798 passed with stages
in 2 minutes and 18 seconds
......@@ -43,9 +43,14 @@
<td>{{user.email}}</td>
<td>{{user.date_joined | date:'d/m/Y - H:i:s'}}</td>
<td>{{user.groups.last.name}}</td>
<td><a href="{% url 'users:edit' user.id %}">
<i class="fa fa-fw fa-pencil" aria-hidden="true"></i>
Edit</a>
<td>
<a href="{% url 'users:edit' user.id %}">
<i class="fa fa-fw fa-pencil" aria-hidden="true"></i> Edit
</a>
<br />
<a href="{% url 'users:delete' user.id %}">
<i class="fa fa-fw fa-times" aria-hidden="true"></i> Delete
</a>
</td>
</tr>
{% endfor %}
......
from django.conf.urls import url
from userprofile.views.users import UserEditView, UserListView
from userprofile.views.users import UserDeleteView, UserEditView, UserListView
urlpatterns = [
url(
......@@ -13,5 +13,11 @@ urlpatterns = [
r"^edit/(?P<pk>\d+)",
UserEditView.as_view(),
name="edit"
),
url(
r"^delete/(?P<pk>\d+)",
UserDeleteView.as_view(),
name="delete"
)
]
......@@ -4,7 +4,7 @@ from django.contrib.auth.models import User
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.views.generic.list import ListView
from django.views.generic.edit import UpdateView
from django.views.generic.edit import DeleteView, UpdateView
class UserListView(LoginRequiredMixin, PermissionRequiredMixin, ListView):
model = User
......@@ -30,3 +30,11 @@ class UserEditView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView):
fields = ['groups']
success_url = reverse_lazy("users:list")
class UserDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView):
model = User
permission_required = 'userprofile.can_edit_users'
template_name = 'user/user_delete_confirm.html'
context_object_name = 'user_delete'
success_url = reverse_lazy("users:list")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment