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:
parent
bdb0f677e5
commit
6242e316ae
@ -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"),
|
||||
|
@ -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"),
|
||||
]
|
||||
|
@ -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})
|
||||
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user