mirror of https://gitlab.crans.org/bde/nk20
add delete boutons, work with only one alias
This commit is contained in:
parent
c77bc0c032
commit
db95944574
|
@ -187,10 +187,13 @@ class AliasView(LoginRequiredMixin,FormMixin,DetailView):
|
||||||
print(alias,alias.pk)
|
print(alias,alias.pk)
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
class DeleteAliasView(DeleteView):
|
class DeleteAliasView(LoginRequiredMixin, DeleteView):
|
||||||
model = Alias
|
model = Alias
|
||||||
success_url = reverse_lazy('member:user_alias')
|
def get_success_url(self):
|
||||||
|
return reverse_lazy('member:user_alias',kwargs={'pk':self.object.note.user.pk})
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
return self.post(request, *args, **kwargs)
|
||||||
|
|
||||||
class ManageAuthTokens(LoginRequiredMixin, TemplateView):
|
class ManageAuthTokens(LoginRequiredMixin, TemplateView):
|
||||||
"""
|
"""
|
||||||
Affiche le jeton d'authentification, et permet de le regénérer
|
Affiche le jeton d'authentification, et permet de le regénérer
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
|
from django_tables2.utils import A
|
||||||
from .models.transactions import Transaction
|
from .models.transactions import Transaction
|
||||||
from .models.notes import Alias
|
from .models.notes import Alias
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ class AliasTable(tables.Table):
|
||||||
'table table condensed table-striped table-hover'
|
'table table condensed table-striped table-hover'
|
||||||
}
|
}
|
||||||
model = Alias
|
model = Alias
|
||||||
fields = ('name',)
|
fields = ('name','pk')
|
||||||
template_name = 'django_tables2/bootstrap4.html'
|
template_name = 'django_tables2/bootstrap4.html'
|
||||||
|
|
||||||
# delete = tables.LinkColumn('member:user_alias_delete', args=[A('id')], attrs={
|
delete = tables.LinkColumn('member:user_alias_delete', args=[A('pk')], attrs={
|
||||||
# 'a': {'class': 'btn'} })
|
'a': {'class': 'btn btn-danger'} },text='delete')
|
||||||
|
|
Loading…
Reference in New Issue