mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-13 21:19:42 +02:00
Merge pull request #1767 from cisagov/za/1601-cancel-invitation-message
(on getgov-backup) Ticket #1601: Add "Cancel invitation" success message
This commit is contained in:
commit
00434d3461
1 changed files with 5 additions and 2 deletions
|
@ -786,14 +786,17 @@ class DomainAddUserView(DomainFormBaseView):
|
||||||
return redirect(self.get_success_url())
|
return redirect(self.get_success_url())
|
||||||
|
|
||||||
|
|
||||||
class DomainInvitationDeleteView(DomainInvitationPermissionDeleteView, SuccessMessageMixin):
|
# The order of the superclasses matters here. BaseDeleteView has a bug where the
|
||||||
|
# "form_valid" function does not call super, so it cannot use SuccessMessageMixin.
|
||||||
|
# The workaround is to use SuccessMessageMixin first.
|
||||||
|
class DomainInvitationDeleteView(SuccessMessageMixin, DomainInvitationPermissionDeleteView):
|
||||||
object: DomainInvitation # workaround for type mismatch in DeleteView
|
object: DomainInvitation # workaround for type mismatch in DeleteView
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
return reverse("domain-users", kwargs={"pk": self.object.domain.id})
|
return reverse("domain-users", kwargs={"pk": self.object.domain.id})
|
||||||
|
|
||||||
def get_success_message(self, cleaned_data):
|
def get_success_message(self, cleaned_data):
|
||||||
return f"Successfully canceled invitation for {self.object.email}."
|
return f"Canceled invitation to {self.object.email}."
|
||||||
|
|
||||||
|
|
||||||
class DomainDeleteUserView(UserDomainRolePermissionDeleteView):
|
class DomainDeleteUserView(UserDomainRolePermissionDeleteView):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue