mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-22 18:38:23 +02:00
Pre-register 2A+
This commit is contained in:
@ -16,8 +16,8 @@ from note.tables import HistoryTable
|
||||
from permission.backends import PermissionBackend
|
||||
from permission.views import ProtectQuerysetMixin
|
||||
|
||||
from .models import WEIClub
|
||||
from .forms import WEIForm
|
||||
from .models import WEIClub, WEIRegistration
|
||||
from .forms import WEIForm, WEIRegistrationForm
|
||||
from .tables import WEITable
|
||||
|
||||
|
||||
@ -48,7 +48,6 @@ class WEICreateView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
|
||||
return reverse_lazy("wei:wei_detail", kwargs={"pk": self.object.pk})
|
||||
|
||||
|
||||
|
||||
class WEIDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
|
||||
"""
|
||||
View WEI information
|
||||
@ -101,3 +100,24 @@ class WEIUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse_lazy("wei:wei_detail", kwargs={"pk": self.object.pk})
|
||||
|
||||
|
||||
class WEIRegisterView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
|
||||
"""
|
||||
Register to the WEI
|
||||
"""
|
||||
model = WEIRegistration
|
||||
form_class = WEIRegistrationForm
|
||||
|
||||
def get_form(self, form_class=None):
|
||||
form = super().get_form(form_class)
|
||||
form.fields["user"].initial = self.request.user
|
||||
return form
|
||||
|
||||
def form_valid(self, form):
|
||||
ret = super().form_valid(form)
|
||||
return ret
|
||||
|
||||
def get_success_url(self):
|
||||
self.object.refresh_from_db()
|
||||
return reverse_lazy("wei:wei_detail", kwargs={"pk": self.object.pk})
|
||||
|
Reference in New Issue
Block a user