mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
changes
This commit is contained in:
parent
963edc1c05
commit
cb771f6208
2 changed files with 18 additions and 17 deletions
|
@ -12,6 +12,7 @@ from .domain import (
|
|||
DomainUsersView,
|
||||
DomainAddUserView,
|
||||
DomainInvitationDeleteView,
|
||||
DomainInvitationCancelView,
|
||||
DomainDeleteUserView,
|
||||
)
|
||||
from .user_profile import UserProfileView, FinishProfileSetupView
|
||||
|
|
|
@ -1054,26 +1054,26 @@ class DomainAddUserView(DomainFormBaseView):
|
|||
# # 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
|
||||
class DomainInvitationDeleteView(SuccessMessageMixin, DomainInvitationPermissionDeleteView):
|
||||
object: DomainInvitation # workaround for type mismatch in DeleteView
|
||||
|
||||
# def post(self, request, *args, **kwargs):
|
||||
# """Override post method in order to error in the case when the
|
||||
# domain invitation status is RETRIEVED"""
|
||||
# self.object = self.get_object()
|
||||
# form = self.get_form()
|
||||
# if form.is_valid() and self.object.status == self.object.DomainInvitationStatus.INVITED:
|
||||
# return self.form_valid(form)
|
||||
# else:
|
||||
# # Produce an error message if the domain invatation status is RETRIEVED
|
||||
# messages.error(request, f"Invitation to {self.object.email} has already been retrieved.")
|
||||
# return HttpResponseRedirect(self.get_success_url())
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""Override post method in order to error in the case when the
|
||||
domain invitation status is RETRIEVED"""
|
||||
self.object = self.get_object()
|
||||
form = self.get_form()
|
||||
if form.is_valid() and self.object.status == self.object.DomainInvitationStatus.INVITED:
|
||||
return self.form_valid(form)
|
||||
else:
|
||||
# Produce an error message if the domain invatation status is RETRIEVED
|
||||
messages.error(request, f"Invitation to {self.object.email} has already been retrieved.")
|
||||
return HttpResponseRedirect(self.get_success_url())
|
||||
|
||||
# def get_success_url(self):
|
||||
# return reverse("domain-users", kwargs={"pk": self.object.domain.id})
|
||||
def get_success_url(self):
|
||||
return reverse("domain-users", kwargs={"pk": self.object.domain.id})
|
||||
|
||||
# def get_success_message(self, cleaned_data):
|
||||
# return f"Canceled invitation to {self.object.email}."
|
||||
def get_success_message(self, cleaned_data):
|
||||
return f"Canceled invitation to {self.object.email}."
|
||||
|
||||
|
||||
class DomainInvitationCancelView(SuccessMessageMixin, DomainInvitationUpdateView):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue