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

Update pre-registrations

This commit is contained in:
Yohann D'ANELLO 2020-04-12 04:39:57 +02:00
parent bdb0f677e5
commit 6242e316ae
4 changed files with 22 additions and 3 deletions

View File

@ -37,7 +37,7 @@ class WEIRegistrationTable(tables.Table):
)
edit = tables.LinkColumn(
'wei:wei_detail',
'wei:wei_update_registration',
args=[A('pk')],
verbose_name=_("Edit"),
text=_("Edit"),

View File

@ -3,7 +3,7 @@
from django.urls import path
from .views import WEIListView, WEICreateView, WEIDetailView, WEIUpdateView, WEIRegisterView
from .views import WEIListView, WEICreateView, WEIDetailView, WEIUpdateView, WEIRegisterView, WEIUpdateRegistrationView
app_name = 'wei'
@ -13,4 +13,5 @@ urlpatterns = [
path('detail/<int:pk>/', WEIDetailView.as_view(), name="wei_detail"),
path('update/<int:pk>/', WEIUpdateView.as_view(), name="wei_update"),
path('register/<int:wei_pk>/', WEIRegisterView.as_view(), name="wei_register"),
path('edit_registration/<int:pk>/', WEIUpdateRegistrationView.as_view(), name="wei_update_registration"),
]

View File

@ -136,3 +136,21 @@ class WEIRegisterView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
def get_success_url(self):
self.object.refresh_from_db()
return reverse_lazy("wei:wei_detail", kwargs={"pk": self.object.wei.pk})
class WEIUpdateRegistrationView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
"""
Update a registration for the WEI
"""
model = WEIRegistration
form_class = WEIRegistrationForm
def get_form(self, form_class=None):
form = super().get_form(form_class)
del form.fields["user"]
return form
def get_success_url(self):
self.object.refresh_from_db()
return reverse_lazy("wei:wei_detail", kwargs={"pk": self.object.wei.pk})

View File

@ -102,7 +102,7 @@
<hr>
{% endif %}
{% if all_registrations.data or True %}
{% if all_registrations.data %}
<div class="card">
<div class="card-header position-relative" id="historyListHeading">
<a class="btn btn-link stretched-link font-weight-bold">