admin: send invitation signal

This commit is contained in:
Jens Langhammer 2018-12-10 16:54:28 +01:00
parent 85a2280eaf
commit 276c6fb297
1 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from django.views.generic import CreateView, DeleteView, ListView
from passbook.admin.mixins import AdminRequiredMixin from passbook.admin.mixins import AdminRequiredMixin
from passbook.core.forms.invitations import InvitationForm from passbook.core.forms.invitations import InvitationForm
from passbook.core.models import Invitation from passbook.core.models import Invitation
from passbook.core.signals import invitation_created
class InvitationListView(AdminRequiredMixin, ListView): class InvitationListView(AdminRequiredMixin, ListView):
@ -29,6 +30,10 @@ class InvitationCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView):
obj = form.save(commit=False) obj = form.save(commit=False)
obj.created_by = self.request.user obj.created_by = self.request.user
obj.save() obj.save()
invitation_created.send(
sender=self,
request=self.request,
invitation=obj)
return HttpResponseRedirect(self.success_url) return HttpResponseRedirect(self.success_url)
class InvitationDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView): class InvitationDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView):