1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-23 16:02:25 +00:00

add deleteView for aliases

This commit is contained in:
Pierre-antoine Comby 2020-02-28 13:52:15 +01:00
parent 9133c84ef2
commit c77bc0c032
2 changed files with 6 additions and 2 deletions

View File

@ -16,8 +16,8 @@ urlpatterns = [
path('user/<int:pk>', views.UserDetailView.as_view(), name="user_detail"),
path('user/<int:pk>/update', views.UserUpdateView.as_view(), name="user_update_profile"),
path('user/<int:pk>/aliases', views.AliasView.as_view(), name="user_alias"),
path('user/aliases/delete/<int:pk>', views.DeleteAliasView.as_view(), name="user_alias_delete"),
path('manage-auth-token/', views.ManageAuthTokens.as_view(), name='auth_token'),
# API for the user autocompleter
path('user/user-autocomplete', views.UserAutocomplete.as_view(), name="user_autocomplete"),
]

View File

@ -5,7 +5,7 @@ from dal import autocomplete
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, DetailView, UpdateView, TemplateView
from django.views.generic import CreateView, DetailView, UpdateView, TemplateView,DeleteView
from django.views.generic.edit import FormMixin
from django.contrib.auth.models import User
from django.urls import reverse_lazy
@ -187,6 +187,10 @@ class AliasView(LoginRequiredMixin,FormMixin,DetailView):
print(alias,alias.pk)
return super().form_valid(form)
class DeleteAliasView(DeleteView):
model = Alias
success_url = reverse_lazy('member:user_alias')
class ManageAuthTokens(LoginRequiredMixin, TemplateView):
"""
Affiche le jeton d'authentification, et permet de le regénérer