mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
Fix activity in Guest model
This commit is contained in:
parent
ceb5690838
commit
34949f0859
@ -29,13 +29,6 @@ class ActivityForm(forms.ModelForm):
|
||||
|
||||
|
||||
class GuestForm(forms.ModelForm):
|
||||
def clean(self, **kwargs):
|
||||
cleaned_data = super().clean()
|
||||
|
||||
self.instance.activity = cleaned_data["activity"] = Activity.objects.get(pk=1)
|
||||
|
||||
return cleaned_data
|
||||
|
||||
class Meta:
|
||||
model = Guest
|
||||
fields = ('last_name', 'first_name', 'inviter', )
|
||||
|
@ -10,7 +10,7 @@ app_name = 'activity'
|
||||
urlpatterns = [
|
||||
path('', views.ActivityListView.as_view(), name='activity_list'),
|
||||
path('<int:pk>/', views.ActivityDetailView.as_view(), name='activity_detail'),
|
||||
path('<int:activity_pk>/invite/', views.ActivityInviteView.as_view(), name='activity_invite'),
|
||||
path('<int:pk>/invite/', views.ActivityInviteView.as_view(), name='activity_invite'),
|
||||
path('<int:pk>/entry/', views.ActivityEntryView.as_view(), name='activity_entry'),
|
||||
path('<int:pk>/update/', views.ActivityUpdateView.as_view(), name='activity_update'),
|
||||
path('new/', views.ActivityCreateView.as_view(), name='activity_create'),
|
||||
|
@ -43,9 +43,15 @@ class ActivityUpdateView(LoginRequiredMixin, UpdateView):
|
||||
class ActivityInviteView(LoginRequiredMixin, CreateView):
|
||||
model = Guest
|
||||
form_class = GuestForm
|
||||
success_url = reverse_lazy('activity:activity_list')
|
||||
template_name = "activity/activity_invite.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.activity = Activity.objects.get(pk=self.kwargs["pk"])
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self, **kwargs):
|
||||
return reverse_lazy('activity:activity_detail', kwargs={"pk": self.kwargs["pk"]})
|
||||
|
||||
|
||||
class ActivityEntryView(LoginRequiredMixin, TemplateView):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user