admin: send invitation signal
This commit is contained in:
parent
85a2280eaf
commit
276c6fb297
|
@ -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):
|
||||||
|
|
Reference in New Issue